我想在 linux 操作系统上安装 electron.js。需要帮助解决以下错误:
安装命令
sudo npm i electron
终端输出
/usr/bin/electron -> /usr/lib/node_modules/electron/cli.js
electron@2.0.8 postinstall /usr/lib/node_modules/electron
node install.js
(node:13668) ExperimentalWarning: The fs.promises API is experimental
/usr/lib/node_modules/electron/install.js:54
throw err
^
Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/electron/electron-tmp-download-13668-1536154444869'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@2.0.8 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@2.0.8 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! /home/ebuilders/.npm/_logs/2018-09-05T13_34_04_997Z-debug.log
最佳答案
我之前遇到过这个错误,每次使用 sudo npm install -g electron --unsafe-perm=true --allow-root
进行安装都能正常工作。
我从这条评论中得到命令:https://github.com/electron/electron/issues/10604#issuecomment-333368230
关于javascript - 如何在 linux 上安装 electron.js?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52186956/