-
카테고리
-
세부 분야
풀스택
-
해결 여부
미해결
sudo npm start && sudo npx pm2 monit 에러
21.01.21 02:04 작성 조회수 723
0
sudo npm start && sudo npx pm2 monit
> node_bird_server@1.0.0 start
> pm2 start app.js
Error: EACCES: permission denied, mkdir '/root/.pm2/logs'
at Object.mkdirSync (node:fs:1005:3)
at mkdirpNativeSync (/home/ubuntu/nodebird/server/node_modules/mkdirp/lib/mkdirp-native.js:29:10)
at Function.mkdirpSync [as sync] (/home/ubuntu/nodebird/server/node_modules/mkdirp/index.js:21:7)
at module.exports.Client.initFileStructure (/home/ubuntu/nodebird/server/node_modules/pm2/lib/Client.js:133:25)
at new module.exports (/home/ubuntu/nodebird/server/node_modules/pm2/lib/Client.js:38:8)
at new API (/home/ubuntu/nodebird/server/node_modules/pm2/lib/API.js:108:19)
at Object.<anonymous> (/home/ubuntu/nodebird/server/node_modules/pm2/lib/binaries/CLI.js:22:11)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:973:32)
Error: EACCES: permission denied, mkdir '/root/.pm2/pids'
at Object.mkdirSync (node:fs:1005:3)
at mkdirpNativeSync (/home/ubuntu/nodebird/server/node_modules/mkdirp/lib/mkdirp-native.js:29:10)
at Function.mkdirpSync [as sync] (/home/ubuntu/nodebird/server/node_modules/mkdirp/index.js:21:7)
at module.exports.Client.initFileStructure (/home/ubuntu/nodebird/server/node_modules/pm2/lib/Client.js:141:25)
at new module.exports (/home/ubuntu/nodebird/server/node_modules/pm2/lib/Client.js:38:8)
at new API (/home/ubuntu/nodebird/server/node_modules/pm2/lib/API.js:108:19)
at Object.<anonymous> (/home/ubuntu/nodebird/server/node_modules/pm2/lib/binaries/CLI.js:22:11)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:973:32)
Error: EACCES: permission denied, open '/root/.pm2/module_conf.json'
at Object.openSync (node:fs:490:3)
at Object.writeFileSync (node:fs:1514:35)
at module.exports.Client.initFileStructure (/home/ubuntu/nodebird/server/node_modules/pm2/lib/Client.js:149:10)
at new module.exports (/home/ubuntu/nodebird/server/node_modules/pm2/lib/Client.js:38:8)
at new API (/home/ubuntu/nodebird/server/node_modules/pm2/lib/API.js:108:19)
at Object.<anonymous> (/home/ubuntu/nodebird/server/node_modules/pm2/lib/binaries/CLI.js:22:11)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:973:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
Error: EACCES: permission denied, mkdir '/root/.pm2/modules'
at Object.mkdirSync (node:fs:1005:3)
at mkdirpNativeSync (/home/ubuntu/nodebird/server/node_modules/mkdirp/lib/mkdirp-native.js:29:10)
at Function.mkdirpSync [as sync] (/home/ubuntu/nodebird/server/node_modules/mkdirp/index.js:21:7)
at module.exports.Client.initFileStructure (/home/ubuntu/nodebird/server/node_modules/pm2/lib/Client.js:157:25)
at new module.exports (/home/ubuntu/nodebird/server/node_modules/pm2/lib/Client.js:38:8)
at new API (/home/ubuntu/nodebird/server/node_modules/pm2/lib/API.js:108:19)
at Object.<anonymous> (/home/ubuntu/nodebird/server/node_modules/pm2/lib/binaries/CLI.js:22:11)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:973:32)
-------------
__/\\\\\\\\\\\\\____/\\\\____________/\\\\____/\\\\\\\\\_____
_\/\\\/////////\\\_\/\\\\\\________/\\\\\\__/\\\///////\\\___
_\/\\\_______\/\\\_\/\\\//\\\____/\\\//\\\_\///______\//\\\__
_\/\\\\\\\\\\\\\/__\/\\\\///\\\/\\\/_\/\\\___________/\\\/___
_\/\\\/////////____\/\\\__\///\\\/___\/\\\________/\\\//_____
_\/\\\_____________\/\\\____\///_____\/\\\_____/\\\//________
_\/\\\_____________\/\\\_____________\/\\\___/\\\/___________
_\/\\\_____________\/\\\_____________\/\\\__/\\\\\\\\\\\\\\\_
_\///______________\///______________\///__\///////////////__
Runtime Edition
PM2 is a Production Process Manager for Node.js applications
with a built-in Load Balancer.
Start and Daemonize any application:
$ pm2 start app.js
Load Balance 4 instances of api.js:
$ pm2 start api.js -i 4
Monitor in production:
$ pm2 monitor
Make pm2 auto-boot at server restart:
$ pm2 startup
To go further checkout:
http://pm2.io/
-------------
Error: EACCES: permission denied, open '/root/.pm2/module_conf.json'
at Object.openSync (node:fs:490:3)
at Object.readFileSync (node:fs:391:35)
at Object.Configuration.getAllSync (/home/ubuntu/nodebird/server/node_modules/pm2/lib/Configuration.js:299:26)
at Object.Configuration.getSync (/home/ubuntu/nodebird/server/node_modules/pm2/lib/Configuration.js:270:30)
at new API (/home/ubuntu/nodebird/server/node_modules/pm2/lib/API.js:117:44)
at Object.<anonymous> (/home/ubuntu/nodebird/server/node_modules/pm2/lib/binaries/CLI.js:22:11)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:973:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
/home/ubuntu/nodebird/server/node_modules/@pm2/agent/src/InteractorClient.js:58
if (stats.uid === 0) {
^
TypeError: Cannot read property 'uid' of undefined
at /home/ubuntu/nodebird/server/node_modules/@pm2/agent/src/InteractorClient.js:58:21
at FSReqCallback.oncomplete (node:fs:194:21)
npm ERR! code 1
npm ERR! path /home/ubuntu/nodebird/server
npm ERR! command failed
npm ERR! command sh -c pm2 start app.js
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-01-20T17_02_45_173Z-debug.log
위와 같이 에러가 발생하는데 어떤게 문제인지 알수있을까요??
답변을 작성해보세요.
1
0
PaPillOn빠삐용
2021.03.26
감사합니다! 말씀하신대로 했더니
[ERROR] Script already launched, add -f option to force re-execution
라는 에러가 또 뜨길래 package.json에서
pm2 start app.js -f
로 강제시켰는데 괜찮겠죠~? ㅎㅎ
0
0
PaPillOn빠삐용
2021.03.26
혹시 해결되었나요? 저도 똑같은 에러가 나와서 여쭤봅니다. 재설치도 해보고 이것저것 해봐도 여전하네요 ㅠ
package.json 다시 node app으로 변경시엔 db연결이 성공적으로 되는데 pm2 start app.js로 변경시에 에러가 뜹니다 ㅠㅠ
답변 4