私はnode.jsを初めて使用しました 私はWindowsマシンにインストールしました。実際に私はtutorialspointのチュートリアルに従っています。インストールの後、私はmain.jsファイルを作成し、次のコードをファイルに書き込むように指示されました。Hello WorldのNode.jsエラーの例
/* Hello, World! program in node.js */
console.log("Hello, World!")
私は$ノードmain.jsを入力して、Node.jsのインタプリタを使用して、main.jsファイルを実行し、しかし、私は次のエラーを持っていました。
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)
私を助けてください。ありがとうございました。
あなたは 'node main.js'をシェルからではなく、ノードREPLから実行したと思います。 –
[ノードREPLがSyntaxErrorをスローする可能性があります:予期せぬ識別子](http://stackoverflow.com/questions/29227486)/node-repl-throws-syntaxerror-unexpected-identifier) –