ReferenceError:退出没有在repl:1:1处定义(在node.js中)

所以我只是试图用这个代码做一个非常基本的Hello World服务器:

var http = require('http'), host = '127.0.0.1', port = '9000'; var server = http.createServer(function(req, res){ res.writeHead(200, { 'Content-Type' : 'text/html'}); res.end('<h1>Hello World!</h1>');}) .listen(port, host, function(){ console.log('Server Running on http://' + host + ':' + port); }) 

当我尝试保存并退出崇高我得到这个错误:

 Error trying to parse project. Expected value in C:\Users\Austin\HelloWorld.js:1:1 

我尝试使用另一个文本编辑器,它让我保存代码,但是当我在REPL中运行它,我得到没有控制台日志,没有Hello World页面,虽然还在运行。 我正在使用Windows x64的最新版本的node.js。

原来Matt Browne的第一个答案是正确的!

崇高是我的问题,当我尝试他的build议时,我使用的是旧版本的JS文件,这就是为什么当我尝试它不工作。