当我尝试使用
在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
建议here
没有运气。
在其他论坛上找不到更多内容。所以请帮忙。 提前谢谢。
答案 0 :(得分:4)
使用:强>
ELECTRON_MIRROR = https://npm.taobao.org/mirrors/electron/ npm install
答案 1 :(得分:2)
很可能你是代理人。
您可以禁用它或在代理后面进行npm安装工作(请参阅this问题)。
答案 2 :(得分:0)
你打错了 安装nodejs-legacy
sudo npm install electron-prebuilt -g
修复它,然后继续安装电子
'%'.$_POST['query'].'%'
答案 3 :(得分:0)
sudo npm install electron -g
这对我有用
答案 4 :(得分:0)
以下步骤对我有用: (假设已经安装了节点和npm)
将npm软件包更新为最新版本:-
sudo npm install npm @ latest -g
已安装带有以下开关的电子:
sudo npm install electronic -g –-verbose --unsafe-perm = true --allow-root
总是欢迎有经验的人提出更正/建议。希望对别人有帮助。
答案 5 :(得分:0)
首先通过{p>安装node
和npm
的最新版本。
$ curl -sL https://deb.nodesource.com/setup_10.x | sudo bash -
$ sudo apt-get install -y nodejs
最新的npm version
现在为6.9.0
,请用npm version
检查npm --version
如果npm version
是6.4.1
,只需先更新npm
,
$ 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
答案 6 :(得分:0)
我到达这里是因为我的最终应用未安装在ubuntu上。
如果有人遇到相同的问题,请转到构建位置并使用以下命令从终端运行:
sudo dpkg -i <name of your install/build file>
ps。我在其他任何地方都找不到此解决方案,这就是为什么我将其发布在这里
答案 7 :(得分: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