【问题标题】:Does this error mean that node modules cant be found?这个错误是否意味着找不到节点模块?
【发布时间】:2020-10-01 15:00:27
【问题描述】:

当我缺少一个模块时,我想我已经在本地计算机上看到了这个错误,但我正在尝试使用 pm2 启动我的代码。这就是这里看到的错误吗?

0|my-ba |     at Object.<anonymous> (/home/user/website/index.js:4:1)
0|my-ba |     at Module._compile (internal/modules/cjs/loader.js:1133:30)
0|my-ba |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
0|my-ba |     at Module.load (internal/modules/cjs/loader.js:977:32)
0|my-ba |     at Function.Module._load (internal/modules/cjs/loader.js:877:14)
0|my-ba |     at Object.<anonymous> (/usr/lib/node_modules/pm2/lib/ProcessContainerFork.js:32:23)
0|my-ba |     at Module._compile (internal/modules/cjs/loader.js:1133:30)
0|my-ba |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
0|my-ba |     at Module.load (internal/modules/cjs/loader.js:977:32)
0|my-ba |     at Function.Module._load (internal/modules/cjs/loader.js:877:14)
0|my-ba |     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
0|my-ba |     at internal/main/run_main_module.js:18:47 {
0|my-ba |   code: 'MODULE_NOT_FOUND',
0|my-ba |   requireStack: [ '/home/user/website/index.js' ]
0|my-ba | }

【问题讨论】:

    标签: node.js digital-ocean pm2


    【解决方案1】:

    它说它不知道如何“启动”您的应用,因为它不在 home/user/website/index.js 中

    您需要编辑您的 package.json 并查看哪个是启动命令并相应地移动您的文件(或编辑,以更方便者为准)

    【讨论】:

    • 谢谢!我会尝试一些东西
    • 我真的确定它在那里?太奇怪了
    • addUser.js botConfig.js gitignore 方法 oauth.js 公共验证.js api.md 配置 index.js 模型 package-lock.json 路由视图 auth.js 配置。 js mainDiscord.js node_modules package.json 策略
    • 对目录结构进行截图并附加到原始问题中。
    • 你有不和吗?
    猜你喜欢
    • 2018-08-22
    • 1970-01-01
    • 2015-10-09
    • 2018-09-04
    • 1970-01-01
    • 1970-01-01
    • 2023-03-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多