javascript - 终端:% Node example.js -bash:fg:没有这样的工作

标签 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/ 登陆页面上的网络服务器示例.

最佳答案

运行 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/

相关文章:

javascript - 最后一次按键事件?

node.js - websocket 客户端 : is node. js 真的比 go (gorilla 和 gobwas) 快吗?

linux - 提取复杂字符串的片段

javascript - 永远停止 Node js

c - 在 execl() bash 返回 eio(输入/输出错误)后从标准输入读取

php - 为什么我在 php exec 中的 bash 中调用 "sh"得到 "echo $0"?

c# - 在 C#.net 中执行实时代码

javascript - 在 hapi/joi 中。如何将 2 个不同的模式验证合并为一个?

javascript - 为什么单击时 stackoverflow.com 上的导航栏会跳转?

javascript - 如何防止用户使用 express 访问客户端 html 文件?