以下答案不能解决你的问题?请在评论区留下你的问题,看到就回复
npm 安装electron模块不成功
$ cnpm install electron --save-dev
其中报错显示
...
> electron@6.0.3 postinstall /Users/xxx/Desktop/study/electron/demo/test-electron/node_modules/electron
> node install.js
Downloading tmp-1875-1-SHASUMS256.txt-6.0.3
[============================================>] 100.0% of 4.54 kB (4.54 kB/s)
/Users/xxx/Desktop/study/electron/demo/test-electron/node_modules/electron/install.js:49
throw err
^
[Error: EACCES: permission denied, mkdir '/Users/xxx/Desktop/study/electron/demo/test-electron/node_modules/electron/dist'] {
errno: -13,
code: 'EACCES',
syscall: 'mkdir',
path: '/Users/xxx/Desktop/study/electron/demo/test-electron/node_modules/electron/dist'
}
npm WARN test-electron@1.0.0 No description
npm WARN test-electron@1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@6.0.3 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@6.0.3 postinstall 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! /Users/xxx/.npm/_logs/2019-08-20T07_21_30_263Z-debug.log
解决方法
sudo rm -rf /Users/xxx/.npm/_logs/2019-08-20T07_21_30_263Z-debug.log
重新安装
$ sudo cnpm install --save-dev electron
B74998:test-electron xxx$ sudo cnpm install --save-dev electron
✔ Installed 1 packages
✔ Linked 132 latest versions
[1/1] scripts.postinstall electron@* run "node install.js", root: "/Users/v_lishaohai/Desktop/study/electron/demo/test-electron/node_modules/_electron@6.0.3@electron"
[1/1] scripts.postinstall electron@* finished in 4s
✔ Run 1 scripts
Recently updated (since 2019-08-13): 3 packages (detail see file /Users/v_lishaohai/Desktop/study/electron/demo/test-electron/node_modules/.recently_updates.txt)
Today:
→ electron@*(6.0.3) (10:05:03)
✔ All packages installed (143 packages installed from npm registry, used 10s(network 5s), speed 366.09kB/s, json 133(268.85kB), tarball 1.63MB)
网友评论