javascript - 如何在 linux 上安装 electron.js?

标签 javascript node.js linux npm electron

我想在 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/

相关文章:

node.js - 当我们已经有了 fs.read 和 fs.write 时,为什么还要使用 fs.open 呢?

javascript - Azure Devops 本地授权错误 401

javascript - 通过模态中的输入字段将值发布到 Controller

javascript - 一个函数中的严格模式是否会影响它调用的函数?

javascript - Grunt 动态变量问题(未定义)

linux - 使用点空格与点斜线执行文件

ruby - 为什么堆栈内存限制系统之间的差异很大?

javascript - 单击后触发事件,Datepicker bootstrap

node.js - GraphQL - POST 正文丢失。你忘记使用 body-parser 中间件了吗?

c++ - OpenCV VideoCapture::set() 返回 false 但成功