我不知道为什么在运行pm2 status
时会遇到此错误:
kaitoSwift@kaito-MacBook-Pro school-sms2 % pm2 status
node:internal/fs/utils:344
throw err;
^
Error: EACCES: permission denied, open '/Users/kaitoSwift/.pm2/pm2.log'
at Object.openSync (node:fs:585:3)
at module.exports.Client.launchDaemon (/usr/local/lib/node_modules/pm2/lib/Client.js:228:12)
at /usr/local/lib/node_modules/pm2/lib/Client.js:104:10
at /usr/local/lib/node_modules/pm2/lib/Client.js:321:14
at processTicksAndRejections (node:internal/process/task_queues:78:11)
at runNextTicks (node:internal/process/task_queues:65:3)
at listOnTimeout (node:internal/timers:528:9)
at processTimers (node:internal/timers:502:7) {
errno: -13,
syscall: 'open',
code: 'EACCES',
path: '/Users/kaitoSwift/.pm2/pm2.log'
}
当我尝试使用npm install pm2 -g
下载pm2时:
kevintrinidad@kaito-MacBook school-sms2 % npm install pm2 -g
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/pm2
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/pm2'
npm ERR! [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/pm2'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules/pm2'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/kaitoSwift/.npm/_logs/2022-04-07T11_15_28_141Z-debug-0.log
3条答案
按热度按时间qzlgjiam1#
要安装PM2,请使用以下命令:
对于
pm2 status
的错误,也是一样的,请尝试:该错误告诉您
/Users/kaitoSwift/.pm2/pm2.log
不存在。mw3dktmi2#
您需要在sudo中运行此命令并验证没有其他进程在同一端口上运行。
cbeh67ev3#