[英]Electron JS install error - Error: EACCES: permission denied
getting error while installing ElectronJS,安装 ElectronJS 时出错,
Error:错误:
Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/electron/.electron'
command tried,命令尝试,
sudo npm install -g electron
sudo npm install -g electron-prebuilt
how to resolve this permission issue?如何解决此权限问题?
You can try with the following command您可以尝试使用以下命令
sudo npm install -g electron --unsafe-perm=true --allow-root
i hope it will be work我希望它会工作
Solved my issue by appending --unsafe-perm=true通过附加--unsafe-perm=true解决了我的问题
command:命令:
sudo npm install -g electron --unsafe-perm=true
unsafe-perm不安全烫发
Default: false if running as root, true otherwise默认值:如果以 root 身份运行,则为 false,否则为 true
Type: Boolean Set to true to suppress the UID/GID switching when running package scripts.类型:Boolean设置为 true 以在运行包脚本时抑制 UID/GID 切换。 If set explicitly to false, then installing as a non-root user will fail.如果显式设置为 false,则以非 root 用户身份安装将失败。
change npm global module default folder , follow this guide更改 npm 全局模块默认文件夹,遵循本指南
https://docs.npmjs.com/getting-started/fixing-npm-permissions https://docs.npmjs.com/getting-started/fixing-npm-permissions
I had a similar problem with npm on my mac and windows system and i fixed them by changing the npm default directory to another directory by following option 2 in the tutorial我在我的 mac 和 windows 系统上遇到了类似的 npm 问题,我通过按照教程中的选项 2 将 npm 默认目录更改为另一个目录来修复它们
I ran into a similar problem.我遇到了类似的问题。 I fixed it by changing folder permissions.我通过更改文件夹权限来修复它。
Check the current folder permissions of the /usr/lib/node_modules directory by running the following command:通过运行以下命令检查 /usr/lib/node_modules 目录的当前文件夹权限:
ls -l /usr/lib | grep "node_modules
Your output will probably be:您的输出可能是:
drwxr-xr-x 3 root root {timestamp} node_modules
Change the owner of the directory to the current user by running the following command:通过运行以下命令将目录的所有者更改为当前用户:
sudo chown -R current_username:current_username /usr/bin/node_modules
Note - Do not run sudo
with any npm command!注意 - 不要使用任何 npm 命令运行sudo
! More information here .更多信息在这里。
Hope this Helps :)希望这可以帮助 :)
With the same message, it could also be that an eletron app is already running using that executable... So the electron binary is actually in use.使用相同的消息,也可能是 eletron 应用程序已经在使用该可执行文件运行......所以电子二进制文件实际上正在使用中。
In that case, just kill the electron app currently running.在这种情况下,只需终止当前正在运行的电子应用程序。
i got the same problem and i can confirm its also working for me on debian distrib我遇到了同样的问题,我可以确认它在 debian distrib 上也对我有用
npm install -g electron --unsafe-perm=true
Thanks you for your help谢谢你的帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.