10

When I try to install electron on Ubuntu 15.04 using

sudo npm install electron-prebuilt -g

This is what I get

/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

I tried

Creating a system link for node with the command: ln -s node nodejs in the /usr/bin/ folder

and

installing node-legacy package: sudo apt-get install node-legacy as suggested here with no luck.

Couldn't find anything more on other forums.So please help. Thanks in advance.

8 Answers 8

9

Following steps worked for me: (Assuming node and npm are already installed)

  1. Updated the npm package to latest:-

    sudo npm install npm@latest -g

  2. Installed electron with following switches:

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

Corrections/Suggestion from experienced people are always welcome. Hope it help to somebody.

1
  • 2
    The only answer that worked for me (having ELIFECYCLE errors). Thanks!
    – Jos
    Jul 2, 2019 at 8:32
4

use:

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

0
2

Most likely you are behind a proxy.

You can disable it or make npm install work behind a proxy (see this question).

5
  • Yes, I'm indeed behind a proxy but I have already set all those config and other applications get installed just fine with npm.
    – ant_1618
    Jul 1, 2015 at 13:40
  • Assuming you have fallowed the instructions in the mentioned post and it didn't work - are you able to disable this proxy? P.S. I've just installed electron-prebuild on a fresh copy of ubuntu just by installing node, npm and linking nodejs to node as you described. So I'm pretty sure it's still a proxy issue.
    – kyrisu
    Jul 1, 2015 at 13:54
  • My network is provided by my institute through a proxy server.So I cannot disable it.I have to work out whatever it takes from behind the proxy itself. Also do you think proxy affects different applications differently? because as I have mentioned,I tried performing installations of other modules and it worked with no errors or warnings
    – ant_1618
    Jul 1, 2015 at 15:58
  • From your output it seems it still has issues with the ssl - it may be because electron-download is using it when downloading electron-prebuild. You can try to download electron from http mirror like so: set ELECTRON_MIRROR=npm.taobao.org/mirrors/electron && npm install electron-prebuild
    – kyrisu
    Jul 2, 2015 at 2:43
  • electron-prebuilt also runs a script which fetches the binaries from aws. You may want to look at this: github.com/mafintosh/electron-prebuilt/issues/21 Oct 29, 2015 at 22:26
0

You typed it wrong install nodejs-legacy

sudo apt-get install nodejs-legacy

to fix it and then continue installing electron

sudo npm install electron-prebuilt -g
0
sudo npm install electron -g

This worked for me

0

First install latest version of node and npm by

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

the latest npm version is now 6.9.0, check the npm version with npm --version if the npm version is 6.4.1 just first update npm by

$ npm install -g npm

If you have problem with permissions caused by sudo then you can cd into .npm-global

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

using chmod command to change permissions of all files and directories in this folder:

$ sudo chmod 777 * -R

After installation you must add this line to the end of .bashrc file:

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

After saving .bashrc just source it by

$ source .bashrc

After all done, you can install electron globally by

$ npm install -g electron
0

I reached here because my final app wasn't installing on ubuntu. In case someone has the same problem go to the build location and run from terminal using : sudo dpkg -i <name of your install/build file> p.s. I didn't find this solution anywhere else which is why I'm posting it here

0

Using this helps me:

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

without --unsafe-perm=true --allow-root I got error message like this:

> 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.