我是node.js和javascript的新手。我成功安装了node.js,但是当我在Mac的终端上运行js文件时,出现错误。
han:~ cuibosoft$ node example.js
module.js:340
throw err;
^
Error: Cannot find module '/Users/cuibosoft/example.js'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
我确定example.js位于/ Users / cuibosoft /。我不知道为什么节点不能。
您可能以为是,但是从您的评论来看,example.js
不能在中/Users/cuibosoft
。如果它在您的桌面上,那么它确实在中/Users/cuibosoft/Desktop
。如果要将其适当地移动到主目录,则可以通过在Finder中打开主目录⌘⇧H。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句