9

当我尝试在 Ubuntu 15.04 上安装电子时,使用

sudo npm install electron-prebuilt -g

这就是我得到的

/usr/local/bin/electron -> /usr/local/lib/node_modules/electron-prebuilt/cli.js

> electron-prebuilt@0.28.3 postinstall /usr/local/lib/node_modules/electron-prebuilt
> node install.js

Downloading electron-v0.28.3-linux-x64.zip
Error: tunneling socket could not be established, cause=139936635598656:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:795:


/usr/local/lib/node_modules/electron-prebuilt/install.js:15
  throw err
        ^
Error: tunneling socket could not be established, cause=139936635598656:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:795:

npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! electron-prebuilt@0.28.3 postinstall: `node install.js`
npm ERR! Exit status 8
npm ERR! 
npm ERR! Failed at the electron-prebuilt@0.28.3 postinstall script.
npm ERR! This is most likely a problem with the electron-prebuilt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node install.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls electron-prebuilt
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.19.0-18-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "electron-prebuilt"
npm ERR! cwd /usr/bin
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.4.21
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /usr/bin/npm-debug.log
npm ERR! not ok code 0

我试过了

使用命令为节点创建系统链接: ln -s node nodejs/usr/bin/文件夹中

安装 node-legacy 包:sudo apt-get install node-legacy 如建议这里 没有运气。

在其他论坛上找不到更多内容。所以请帮忙。提前致谢。

4

8 回答 8

8

以下步骤对我有用:(假设节点和 npm 已经安装)

  1. 将 npm 包更新到最新版本:-

    sudo npm install npm@latest -g

  2. 安装有以下开关的电子:

    sudo npm install electron -g --verbose --unsafe-perm=true --allow-root

随时欢迎有经验的人提供更正/建议。希望它对某人有所帮助。

于 2019-02-12T13:24:57.600 回答
4

利用:

ELECTRON_MIRROR= https://npm.taobao.org/mirrors/electron/ npm install

于 2016-06-21T09:28:30.720 回答
2

您很可能在代理后面。

您可以禁用它或使 npm install 在代理后面工作(请参阅问题)。

于 2015-07-01T13:32:30.337 回答
0
sudo npm install electron -g

这对我有用

于 2018-11-30T06:37:03.290 回答
0

使用它可以帮助我:

sudo npm install electron -g  --unsafe-perm=true --allow-root

没有--unsafe-perm=true --allow-root我收到这样的错误消息:

> electron@10.1.5 postinstall /usr/local/lib/node_modules/electron
> node install.js

Error: EACCES: permission denied, mkdtemp 
'/usr/local/lib/node_modules/electron/electron-download-rSlUcU'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@10.1.5 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the electron@10.1.5 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!     /root/.npm/_logs/2020-11-13T04_43_27_809Z-debug.log
于 2020-11-13T04:48:07.503 回答
0

首先安装最新版本的nodeand npmby

$ curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
$ sudo apt-get install -y nodejs

最新的npm version是现在,6.9.0检查 是否只是第一次更新npm versionnpm --versionnpm version6.4.1npm

$ npm install -g npm

如果您有权限问题,sudo那么您可以cd进入 .npm-global

$ cd /home/user_home_directory/.npm-global/

使用chmod命令更改此文件夹中所有文件和目录的权限:

$ sudo chmod 777 * -R

安装后,您必须将此行添加到.bashrc文件末尾:

export PATH="/home/user_home_directory/.npm-global/bin:$PATH"

在保存它.bashrc之后source

$ source .bashrc

完成后,您可以electron通过以下方式全局安装

$ npm install -g electron
于 2019-05-21T08:50:48.373 回答
0

你打错了 install nodejs-legacy

sudo apt-get install nodejs-legacy

修复它,然后继续安装电子

sudo npm install electron-prebuilt -g
于 2016-11-19T12:05:59.760 回答
0

我到达这里是因为我的最终应用程序没有安装在 ubuntu 上。如果有人遇到同样的问题,请转到构建位置并使用以下命令从终端运行: sudo dpkg -i <name of your install/build file> ps 我在其他任何地方都没有找到这个解决方案,这就是我在这里发布它的原因

于 2019-05-28T07:29:27.893 回答