终端:% node example.js -bash: fg: 没有这样的工作
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/24880989/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
terminal: % node example.js -bash: fg: no such job
提问by Geoffrey Hale
In Terminal, when I try to run % node example.js
why do I get -bash: fg: %: no such job
?
在终端中,当我尝试运行时,% node example.js
为什么会出现-bash: fg: %: no such job
?
I've installed Node.js. I've saved example.js with the example code:
我已经安装了 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/');
This is following the webserver example on the landing page of http://nodejs.org/.
这是在http://nodejs.org/登陆页面上的网络服务器示例。
采纳答案by Geoffrey Hale
Running node example.js
is successful without the %
.
运行node example.js
成功没有%
。
node example.js
results in:
Server running at http://127.0.0.1:1337/
node example.js
结果是:
Server running at 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
% 用于定义一个作业,它需要一个作业标识符(数字、字符串等)。另外我认为在那个网站上他们使用 % 作为提示。试试 node example.js – Jidder
Credit: Jidder
信用:吉德
回答by Sangha11
% is often used as the prompt, I had a similar situation when running a mongo shell command from mongolab.
% 经常用作提示,我在从 mongolab 运行 mongo shell 命令时遇到了类似的情况。
Run the command after the %.
在 % 之后运行命令。