我写的
hello.js
var http = require(‘http’);
http.createServer(function (req, res) {
res.writeHead(200, {’Content-Type’: 'text/plain’});
res.end(‘Hello Node.jsn’);
}).listen(8124, “127.0.0.1”);
console.log(‘Server running at http://127.0.0.1:8124/’);
运行 node hello.js 结果显示: ReferenceError:hello is not defined at repl:1:2 at … …
node.js:201 throw e; //process.nextTick error.or ‘error’ event on first tick ReferenceError:hello is not defined at Object. … … …
按你说的执行,结果是:node.js:201 throw e; //process.nextTick error.or ‘error’ event on first tick ReferenceError:hello is not defined at Object.<anonymous> <D:Node\hello.js:1:16> … … …
node.js:116 throw e; // process.nextTick error, or ‘error’ event on first tick ^ ReferenceError: hello is not defined at Object.<anonymous> (/home/Wang/node-v0.4.0/hello.js:1:63) at Module._compile (module.js:373:26) at Object…js (module.js:379:10) at Module.load (module.js:305:31) at Function._load (module.js:271:10) at Array.<anonymous> (module.js:392:10) at EventEmitter._tickCallback (node.js:108:26) 这是我用cygwin安装的,路径/home/Wang/node-v0.4.0/hello.js。。。。