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 justnode example.js
– user3442743 Commented Jul 22, 2014 at 7:16
2 Answers
Reset to default 0Running 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 %.