使用 pm2 启动 Node.js 项目时出错

问题描述 投票:0回答:1

我在 Node.js 中有一个富有成效的项目。为了启动它,我使用 pm2 并且安装了 npm、pm2 和 node。问题是,当我启动所有内容并给出 pm2 状态时,它会发送错误的所有内容。为了看看会发生什么,我给出了 pm2 日志,它向我抛出了几个如下错误:

/root/.pm2/logs/index-out.log last 15 lines:
/root/.pm2/logs/index-error.log last 15 lines:
0|index    |     at require (internal/modules/cjs/helpers.js:74:18)
0|index    |     at Object.<anonymous> (/DATA/rabbitmq/util/tools.js:2:19)
0|index    |     at Module._compile (internal/modules/cjs/loader.js:999:30)
0|index    |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
0|index    |     at Module.load (internal/modules/cjs/loader.js:863:32)
0|index    |     at Function.Module._load (internal/modules/cjs/loader.js:708:14)
0|index    |     at Module.require (internal/modules/cjs/loader.js:887:19)
0|index    |     at Module.Hook._require.Module.require (/usr/local/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:101:39) {
0|index    |   code: 'MODULE_NOT_FOUND',
0|index    |   requireStack: [
0|index    |     '/DATA/rabbitmq/util/tools.js',
0|index    |     '/DATA/rabbitmq/util/loadEnv.js',
0|index    |     '/DATA/rabbitmq/index.js'
0|index    |   ]
0|index    | }
node.js node-modules pm2
1个回答
0
投票

要解决这个问题,需要运行net命令

npm i
© www.soinside.com 2019 - 2024. All rights reserved.