簡體   English   中英

節點代表顯示錯誤

[英]node repl showing error

我是node.js的新手,當我嘗試運行Hello world應用程序時顯示錯誤。我創建了一個main.js文件,並使用node repl我稱為$ node main.js,這導致了錯誤

SyntaxError: Unexpected identifier
at 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)

之后我在普通命令提示符下嘗試了相同的操作,遍歷main.js並執行了節點main.js然后顯示了輸出,但是在示例中,JS是使用節點repl執行的,這完全令人困惑。 repl中的節點也顯示錯誤。 請幫忙

您需要在OS命令/ shell提示符下執行node main.js ,而不是節點repl。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM