我对node.js非常新手。在node REPL中一切都很正常。但是出现了一些变化。当我尝试执行一个文件时,它显示如下内容...
D:\Projects-2015\uniqueva>node
/>node module.js
SyntaxError: Unexpected identifier
at Object.exports.createScript (vm.js:44:10)
at REPLServer.defaultEval (repl.js:117:23)
at bound (domain.js:254:14)
at REPLServer.runBound [as eval] (domain.js:267:12)
at REPLServer.<anonymous> (repl.js:279:12)
at REPLServer.emit (events.js:107:17)
at REPLServer.Interface._onLine (readline.js:214:10)
at REPLServer.Interface._line (readline.js:553:8)
at REPLServer.Interface._ttyWrite (readline.js:830:14)
at ReadStream.onkeypress (readline.js:109:10)
即使我尝试这样做,仍然会出现这种情况...
node --version
我在module.js中有以下代码...
var http = require("http");
http.createServer(function(request, response){
response.writeHead(200, {"Content-Type" : "text/plain"});
response.write("Hello World");
response.end();
}).listen(8888);
即使我只尝试控制台输出某些内容,或者干脆将文件留空,也会有同样的问题。
![在此输入图片描述](https://istack.dev59.com/OEGaO.webp)
module.js
文件里有什么内容? - Osukaa