javascript - terminal: % node example.js -bash: fg: no such job - Stack Overflow

In Terminal, when I try to run % node example.js why do I get -bash: fg: %: no such job?I've insta

In Terminal, when I try to run % node example.js why do I get -bash: fg: %: no such job?

I've installed Node.js. I've saved example.js with the example code:

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 /.

In Terminal, when I try to run % node example.js why do I get -bash: fg: %: no such job?

I've installed Node.js. I've saved example.js with the example code:

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/.

Share Improve this question asked Jul 22, 2014 at 7:10 Geoffrey HaleGeoffrey Hale 11.5k5 gold badges45 silver badges49 bronze badges 1
  • 3 % 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 – user3442743 Commented Jul 22, 2014 at 7:16
Add a ment  | 

2 Answers 2

Reset to default 0

Running node example.js is successful without the %.

node example.js results in: 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

Credit: Jidder

% is often used as the prompt, I had a similar situation when running a mongo shell mand from mongolab.

Run the mand after the %.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744348361a4569824.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信