Sono nuovo su node.js Ho appena finito di installarlo sulla mia macchina Windows. In realtà sto seguendo un tutorial su tutorialspoint. Dopo l'installazione mi è stato detto di creare un file main.js e inserire il seguente codice nel file.Errore Node.js per esempio Hello World
/* Hello, World! program in node.js */
console.log("Hello, World!")
I file eseguiti utilizzando main.js Node.js interprete digitando $ main.js nodi, ma ho avuto i seguenti errori.
SyntaxError: Unexpected identifierat Object.exports.createScript
(vm.js:24:10)
at REPLServer.defaultEval (repl.js:221:25)
at bound (domain.js:280:14)
at REPLServer.runBound [as eval] (domain.js:293:12)
at REPLServer.<anonymous> (repl.js:412:12)
at emitOne (events.js:82:20)
at REPLServer.emit (events.js:169:7)
at REPLServer.Interface._onLine (readline.js:210:10)
at REPLServer.Interface._line (readline.js:549:8)
at REPLServer.Interface._ttyWrite (readline.js:826:14)
Please help me out. Grazie.
Penso che si esegua il 'nodo main.js' non dalla shell, ma dal nodo REPL) –
Possibile duplicato di [NPT REPL genera SyntaxError: identificatore imprevisto] (http://stackoverflow.com/questions/29227486/node-repl-throws-syntaxerror-identificatore imprevisto) –