电子:权限被拒绝的代码ELIFECYCLE errno 126

时间:2018-12-22 19:28:00

标签: node.js ubuntu electron

我已经用nvm安装了nodejs,目前在Ubuntu 18.04上使用版本11.5.0

我只是想开始学习用电子编程,所以我使用了code example on GitHub,在运行npm start后出现了这个错误:

> electron-quick-start@1.0.0 start /home/alireza/extra/projects/vm/electron-quick-start
> electron .

sh: 1: electron: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! electron-quick-start@1.0.0 start: `electron .`
npm ERR! Exit status 126
npm ERR! 
npm ERR! Failed at the electron-quick-start@1.0.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!     /home/alireza/.npm/_logs/2018-12-22T19_09_38_515Z-debug.log

所以日志看起来像这样(很长的日志文件很抱歉):

0 info it worked if it ends with ok
1 verbose cli [ '/home/alireza/.nvm/versions/node/v11.5.0/bin/node',
1 verbose cli   '/home/alireza/.nvm/versions/node/v11.5.0/bin/npm',
1 verbose cli   'start' ]
2 info using npm@6.4.1
3 info using node@v11.5.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle electron-quick-start@1.0.0~prestart: electron-quick-start@1.0.0
6 info lifecycle electron-quick-start@1.0.0~start: electron-quick-start@1.0.0
7 verbose lifecycle electron-quick-start@1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle electron-quick-start@1.0.0~start: PATH: /home/alireza/.nvm/versions/node/v11.5.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/alireza/extra/projects/vm/electron-quick-start/node_modules/.bin:/home/alireza/.nvm/versions/node/v11.5.0/bin:/home/alireza/.local/bin:/home/alireza/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle electron-quick-start@1.0.0~start: CWD: /home/alireza/extra/projects/vm/electron-quick-start
10 silly lifecycle electron-quick-start@1.0.0~start: Args: [ '-c', 'electron .' ]
11 silly lifecycle electron-quick-start@1.0.0~start: Returned: code: 126  signal: null
12 info lifecycle electron-quick-start@1.0.0~start: Failed to exec start script
13 verbose stack Error: electron-quick-start@1.0.0 start: `electron .`
13 verbose stack Exit status 126
13 verbose stack     at EventEmitter.<anonymous> (/home/alireza/.nvm/versions/node/v11.5.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:189:13)
13 verbose stack     at ChildProcess.<anonymous> (/home/alireza/.nvm/versions/node/v11.5.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:189:13)
13 verbose stack     at maybeClose (internal/child_process.js:978:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
14 verbose pkgid electron-quick-start@1.0.0
15 verbose cwd /home/alireza/extra/projects/vm/electron-quick-start
16 verbose Linux 4.15.0-43-generic
17 verbose argv "/home/alireza/.nvm/versions/node/v11.5.0/bin/node" "/home/alireza/.nvm/versions/node/v11.5.0/bin/npm" "start"
18 verbose node v11.5.0
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 126
22 error electron-quick-start@1.0.0 start: `electron .`
22 error Exit status 126
23 error Failed at the electron-quick-start@1.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 126, true ]

所以我被困在这里,尝试了很多事情。从一次又一次地删除rm -rf node-modulesnpm install的node_modules到更改和检查对node_modules等的访问权限。

您是否还有此问题,或者您知道如何解决此问题?

0 个答案:

没有答案