ubuntu - 无法全局安装 Electron

标签 ubuntu npm electron

我正在尝试在全局范围内安装 Electron ,但我遇到了这个烦人的错误消息

/home/tbh/.npm-global/bin/electron -> /home/tbh/.npm-global/lib/node_modules/electron/cli.js

> electron@2.0.8 postinstall /home/tbh/.npm-global/lib/node_modules/electron
> node install.js

/home/tbh/.npm-global/lib/node_modules/electron/install.js:54
  throw err
  ^

Error: EACCES: permission denied, mkdir '/home/tbh/.npm-global/lib/node_modules/electron/dist'
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.

我已经尝试了几件事,包括使用 sudo 运行它和更改 NPM 配置来认可 Stackoverflow 上的这个问题
但没有什么对我有用
如果有人需要这个问题的日志,你可以在这里找到它 here
PS:我的操作系统是 Ubuntu 18.04

最佳答案

尝试安装:sudo npm install -g electron --unsafe-perm=true --allow-root反而。

来源:https://github.com/electron/electron/issues/10604#issuecomment-333368230

关于ubuntu - 无法全局安装 Electron ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52032619/

相关文章:

electron - 如何获取在 Electron 的 webview 中打开的页面的 HTTP 状态代码

Makefile 中的 C : Unix SDL2 library : undefined reference, 问题?

ubuntu - sam local start-api go lambda 在 linux ubuntu 上返回 502 "internal server error"

linux - Ubuntu 老升级 8.04 -> 12.04

bash - 在 shell 脚本中解压缩文件时出错。 - 需要PK兼容。 v5.1(可以做v4.6)

javascript - 符号的音译删除

typescript - 带有计时器的对话框

node.js - 'npm run'命令和Windows控制台之间的行为不同

javascript - Grunt 安装在 Ubuntu 上但无法正常工作

electron - 为什么 Select2 不会覆盖 Electron 中的正常选择框?