thx / rap2-delos

阿里妈妈前端团队出品的开源接口管理工具RAP第二代
http://rap2.taobao.org
MIT License
7.65k stars 1.35k forks source link

npm run build和 npm run dev均正常。但使用npm start报错 Error: spawn pm2 ENOENT #755

Closed madguy520 closed 3 years ago

madguy520 commented 3 years ago

BUG描述 配置好参数后。npm run build和 npm run dev均正常。但使用npm start报错。

复现步骤 使用npm start报错。

期望结果 启动。

实际结果 启动失败。

截图 npm start

rap2-delos@2.9.0 start /usr/local/software/rap2.2.3/rap2-delos-2.2.3 cross-env NODE_ENV=production pm2 start dist/dispatch.js --name=rap-server-delos

events.js:187 throw er; // Unhandled 'error' event ^

Error: spawn pm2 ENOENT at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19) at onErrorNT (internal/child_process.js:456:16) at processTicksAndRejections (internal/process/task_queues.js:80:21) Emitted 'error' event on ChildProcess instance at: at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12) at onErrorNT (internal/child_process.js:456:16) at processTicksAndRejections (internal/process/task_queues.js:80:21) { errno: 'ENOENT', code: 'ENOENT', syscall: 'spawn pm2', path: 'pm2', spawnargs: [ 'start', 'dist/dispatch.js', '--name=rap-server-delos' ] } npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! rap2-delos@2.9.0 start: cross-env NODE_ENV=production pm2 start dist/dispatch.js --name=rap-server-delos npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the rap2-delos@2.9.0 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2020-12-07T05_33_49_595Z-debug.log

环境 Centos7.9

附加信息

kyiln commented 3 years ago

你把 pm2 做一个alias为 pm2 就可以了 ln -s /usr/local/soft/node-v9.3.0-linux-x64/bin/pm2 /usr/bin/pm2

前面是你的pm2的真实路径

可以采用 find / -name pm2 查找到路径。在你的node里面哈

madguy520 commented 3 years ago

你把 pm2 做一个alias为 pm2 就可以了 ln -s /usr/local/soft/node-v9.3.0-linux-x64/bin/pm2 /usr/bin/pm2

前面是你的pm2的真实路径

可以采用 find / -name pm2 查找到路径。在你的node里面哈

额。我没有pm2. npm install -g pm2 需要这样安装一下就行了。

madguy520 commented 3 years ago

安装好就正常了。感谢回复!

Bosn commented 3 years ago

sorry回复晚了,解决了就好。着急问题可以进群艾特群主答疑哈