terminal:%node example.js -bash:fg:没有这样的工作

时间:2014-07-22 07:10:45

标签: javascript node.js bash terminal

在终端中,当我尝试运行% node example.js时,为什么我会-bash: fg: %: no such job

我已经安装了Node.js.我已经使用示例代码保存了example.js:

var http = require('http');
http.createServer(function (req, res) {
  res.writeHead(200, {'Content-Type': 'text/plain'});
  res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');

这是关注http://nodejs.org/着陆页上的网络服务器示例。

2 个答案:

答案 0 :(得分:0)

在没有node example.js的情况下正常运行%

node example.js会导致: Server running at http://127.0.0.1:1337/

  

%用于定义作业,它需要一个作业标识符(数字,字符串等)。   另外我认为在该网站上他们使用%作为提示。   尝试只是节点example.js    - Jidder

信用:Jidder

答案 1 :(得分:0)

%通常用作提示,从mongolab运行mongo shell命令时,我遇到类似的情况。

在%之后运行命令。