[英]Unable to install electron from npm
我正在尝试在我的 ubuntu 16.04 上安装电子,我已经有一个工作的 nodejs 和 npm。 但突然我无法按类型安装模块:sudo npm install electron
以下是收到的回复:
npm WARN registry Unexpected warning for https://registry.npmjs.org/:
Miscellaneous Warning EAI_AGAIN: request to
https://registry.npmjs.org/electron failed, reason: getaddrinfo
EAI_AGAIN registry.npmjs.org:443
npm WARN registry Using stale package data from
https://registry.npmjs.org/ due to a request error during
revalidation.
> electron@1.7.10 postinstall
/home/arthur/Documents/Programming/Electron/node_modules/electron
> node install.js
`/home/arthur/Documents/Programming/Electron/node_modules/electron/
install.js:48
该问题与代理配置有关。 基于此答案,您可以尝试以下操作。
首先,尝试删除是否存在您的初始配置:
npm config rm proxy
npm config rm https-proxy
如果需要,可以选择尝试设置您的代理配置
npm config set proxy proxy-url
npm config set https-proxy proxy-url
删除代理和 https-proxy 对我有用,以防万一有人遇到类似情况。 只需在终端中输入以下内容:
npm config rm proxy
npm config rm https-proxy
我尝试了所有方法,但似乎我使用的是 CENTOS,它允许我安装电子。 我从FlashJonas那里得到了帮助:并尝试再次安装电子,并按预期安装。
sudo npm install electron -g --verbose --unsafe-perm=true
执行以下任一操作。 它对我有用。
这个错误是因为它无法下载“electron-v11.2.1-win32-x64.zip”文件。 所以改变互联网连接它对我有用。
我支持公司代理并且有类似的问题。 上述选项均无帮助。 最后,我按照下面的说明手动重建了电子缓存,这样它就不必访问网络来下载二进制文件:
https://www.electronjs.org/docs/v14-xy/tutorial/installation#custom-mirrors-and-caches
基本上我使用个人笔记本电脑(即不在代理后面)在一些测试应用程序上安装最新的电子,然后将%LOCALAPPDATA%\\electron\\Cache
文件夹从我的个人复制到公司笔记本电脑。 一切正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.