Egg: 在本地npm install 使用npm run dev是可以启动的,部署到linux中npm start 就报/.bin/egg-scripts: Permission denied

Created on 13 Mar 2019  ·  7Comments  ·  Source: eggjs/egg

sh: /app/project/egg-catalogbuy/node_modules/.bin/egg-scripts: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! [email protected] start: egg-scripts start --daemon --title=egg-jiucaiyun
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the [email protected] 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! /home/admin/.npm/_logs/2019-03-13T10_45_23_428Z-debug.log

2019-03-13T10_45_23_428Z-debug.log内容如下:
0 info it worked if it ends with ok
1 verbose cli [ '/app/nodejs/node-v8.11.2-linux-x64/bin/node',
1 verbose cli '/usr/bin/npm',
1 verbose cli 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: /app/nodejs/node-v8.11.2-linux-x64/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/app/project/egg-catalogbuy/node_modules/.bin:/app/jdk1.8.0_111/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/admin/.local/bin:/home/admin/bin:/app/nodejs/node-v8.11.2-linux-x64/bin::/home/admin/.local/bin:/home/admin/bin:/app/apache-maven-3.5.3/bin:/app/gradle-4.0.1/bin
9 verbose lifecycle [email protected]~start: CWD: /app/project/egg-catalogbuy
10 silly lifecycle [email protected]~start: Args: [ '-c', 'egg-scripts start --daemon --title=egg-jiucaiyun' ]
11 silly lifecycle [email protected]~start: Returned: code: 126 signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: egg-scripts start --daemon --title=egg-jiucaiyun
13 verbose stack Exit status 126
13 verbose stack at EventEmitter. (/app/nodejs/node-v8.11.2-linux-x64/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess. (/app/nodejs/node-v8.11.2-linux-x64/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid [email protected]
15 verbose cwd /app/project/egg-catalogbuy
16 verbose Linux 3.10.0-862.6.3.el7.x86_64
17 verbose argv "/app/nodejs/node-v8.11.2-linux-x64/bin/node" "/usr/bin/npm" "start"
18 verbose node v8.11.2
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 126
22 error [email protected] start: egg-scripts start --daemon --title=egg-jiucaiyun
22 error Exit status 126
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 126, true ]

All 7 comments

错误很清晰的告诉你 权限问题

这个必须要用root用户才行吗

我把node_modules删除了,然后重新npm install 就行了这是为什么,我不怎么理解

你打包部署的时候,权限丢掉了,属于 Linux 相关知识,可以自行了解下。

这个锅我们鸡蛋不背,找运维同事/朋友帮你看看就能迅速解决问题啦,当然自行了解是更好的。

不仅仅是技多不压身,而是深入了解后端的话,系统原理/网络通信是绝对绕不过的,加油吧小老弟😄

chmod +x 一下现在好了,不过对权限还是不怎么理解

我把node_modules删除了,然后重新npm install 就行了这是为什么,我不怎么理解

我也是删了重下下就可以了。root也是权限不足。npm镜像源切换然后下载就可以了
npm config set registry http://registry.npm.taobao.org

Was this page helpful?
0 / 5 - 0 ratings

Related issues

popomore picture popomore  ·  47Comments

Yao-JSON picture Yao-JSON  ·  34Comments

atian25 picture atian25  ·  68Comments

popomore picture popomore  ·  38Comments

musicode picture musicode  ·  55Comments