Node REPL throws SyntaxError: Unexpected identifier

血红的双手。 提交于 2019-12-01 22:39:49

You can't call the node executable from within the node REPL... Only JavaScript statements/expressions.

Try require('./module.js')

Are you running node by double clicking on it?

You have to run node from command line and give command node xyz.js on command line.

node should be in your class path or while executing node use full path. such as c:\work\nodetest\node .\xyz.js

in above i coped the js file in same folder as node file.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!