在终端中运行 JS 时找不到模块错误
这是我今天第一次使用节点,我遇到了这个问题。当尝试在终端中运行 hello.js 时,出现此错误:
Error: Cannot find module '/Users/antoinelafonta/hello.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
使用 VsCode 终端时运行正常。
有什么想法吗?
谢谢 !
It's my firt time using node today and I was faced with this issue. When trying to run hello.js in my terminal, I get this error :
Error: Cannot find module '/Users/antoinelafonta/hello.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
It's running fine when using the VsCode terminal.
Any ideas ?
Thanks !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论