Ich bin neu bei node.js Ich habe gerade die Installation auf meiner Windows-Maschine beendet. Eigentlich folge ich einem Tutorial auf Tutorialpoint. Nach der Installation wurde mir gesagt, dass ich eine main.js-Datei erstellen und den folgenden Code in die Datei einfügen sollte.Node.js Fehler für Hello World Beispiel
/* Hello, World! program in node.js */
console.log("Hello, World!")
I ausgeführt main.js Datei von Node.js Interpreter Knoten main.js Eingabe $, aber ich hatte die folgenden Fehler.
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)
Bitte helfen Sie mir. Vielen Dank.
Ich denke, Sie sind Ihre 'node main.js' nicht aus Shell, sondern von Knoten REPL) –
Mögliche Duplikat von [Node REPL wirft SyntaxError: Unerwartete Kennung] (http://StackOverflow.com/questions/29227486/node-repl-throws-syntaxerror-unerwartete-identifier) –