在终端中,当我尝试运行 % 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/ 登陆页面上的网络服务器示例.
最佳答案
运行 node example.js
成功,无需 %
。
node example.js
结果:
服务器运行在http://127.0.0.1:1337/
% is used to define a job, it expects a job identifier(number,string,etc) after it. Also i think on that website they are using % as the prompt. Try just node example.js – Jidder
信用:Jidder
关于javascript - 终端:% Node example.js -bash:fg:没有这样的工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24880989/