node v0.12.0
Код:
var http = require('http');
var url = require('url');
var arr = [];
var server = new http.Server(function(req,res){
var uparse = url.parse(req.url,true);
arr.push(uparse.query.msg);
res.writeHead(200,{"Content-Type": "text/html"});
var str = '';
for(i=0;i<arr.length;i++){
if(typeof(arr[i])==='undefined'){
continue;
}
str += '<p>'+arr[i]+'</p>';
}
res.end(str);
});
server.listen(1337, '127.0.0.1');
Ошибка
Код:
|
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) |
Почему возникает эта ошибка? на предыдущей версии нода все работало!