Install electron on ubuntu - node.js

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.

Following steps worked for me:
(Assuming node and npm are already installed)
Updated the npm package to latest:-
sudo npm install npm#latest -g
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.

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

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

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

sudo npm install electron -g
This worked for me

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

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

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

Related

Why can't I install a specific version of npm and how can I do it?

My Linux distribution is:
uname -a
Linux 16.04.2-Ubuntu
Also, my npm version was:
npm -v
3.5.2
I wanted to install version 3.10.10 of npm via this command:
sudo npm cache clean -f
sudo npm install npm#3.10.10
But I get these errors:
npm WARN enoent ENOENT: no such file or directory, open '/home/arvin/package.json'
npm WARN myname No description
npm WARN myname No repository field.
npm WARN myname No README data
npm WARN myname No license field.
And when using the same command for installed version 6.12.2 of Node.js:
sudo npm install nodejs#6.12.2
And I get these errors:
npm ERR! Linux 4.13.0-26-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "nodejs#6.12.2"
npm ERR! node v4.2.6
npm ERR! npm v3.5.2
npm ERR! No compatible version found: nodejs#6.12.2
npm ERR! Valid install targets:
npm ERR! 0.0.0
npm ERR!
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /home/arvin/npm-debug.log
Finally, I decided to completely remove `npm' and Node.js via these commands:
sudo apt-get purge --auto-remove nodejs
sudo apt autoremove
sudo rm -R ~/.npm
sudo rm /usr/local/bin/npm, /usr/local/share/man/man1/node, /usr/local/lib/dtrace/node.d, ~/.node-gyp, /opt/local/bin/node, opt/local/include/node, /opt/local/lib/node_modules
sudo npm uninstall npm
So, how can I install npm v3.10.10 and Node.js v6.12.2 in Ubuntu 16.04 (Xenial Xerus)?
If you want to use npm to install npm, you need to use the -g flag to signal that the package should be installed globally. If you install without the -g flag, it will try to find a package.json file in the local directory.
sudo npm install -g npm#3.10.10
Btw, you cannot install Node.js with npm. To manage Node.js versions, you can use either nvm or n. I recommend using n.

Plesk install npm packages Error

I created an API that use hummus.js modules. Localy tested -> Works fine.
Now I uploaded my API and try to run npm install to install all dependencies. But I got this Error:
npm-Installation
Execution filemng has failed with exit code 1, stdout:
> hummus#1.0.81 install /var/www/vhosts/XXX/XXX/node_modules/hummus
> node-pre-gyp install --fallback-to-build
, stderr: npm WARN lifecycle npm is using /opt/plesk/node/7/bin/node but there is no node binary in the current PATH. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
/usr/bin/env: 'node': No such file or directory
npm WARN XXX#0.0.1 No description
npm WARN XXX#0.0.1 No repository field.
npm WARN XXX#0.0.1 No license field.
npm ERR! Linux 4.4.0-21-generic
npm ERR! argv "/opt/plesk/node/7/bin/node" "/opt/plesk/node/7/bin/npm" "install"
npm ERR! node v7.4.0
npm ERR! npm v4.0.5
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! hummus#1.0.81 install: `node-pre-gyp install --fallback-to-build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the hummus#1.0.81 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the hummus package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs hummus
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls hummus
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /var/www/vhosts/XXX/XXX/npm-debug.log
The Error come from the hummus-js package.
So I want to try install node-gyp ( npm install -g node-gyp ). But I don't know how? In Plesk I canno't install a single module. When I try it with ssh i got:
command NPM not found
I'm a Server-Admin-Noob so I'm happy for every Help!
Greetings
EDIT:
My Server = Ubuntu 16.04 LTS Server 64bit + Plesk Onyx
If I assumed correctly, it boils down to you not having Node installed on your other machine. SSH into the machine, then, for debian and ubuntu-based OS run
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
(assuming, again, that you wanted Node 8.x), then run
sudo apt-get install -y build-essential
and for CentOS and other enterprise Linux OS:
curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -
sudo yum -y install nodejs
sudo yum install gcc-c++ make
Then try redoing what you did.

Node 8.0 install, but npm stuck on old version

Installed node version v8 on windows 10. It says it comes delivered with npm 5....
But it's stuck on 3.5.3
λ npm i -g npm
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "npm" "i" "-g" "npm"
npm ERR! node v8.0.0
**npm ERR! npm v3.5.3**
**npm ERR! code MODULE_NOT_FOUND**
**npm ERR! Cannot find module 'internal/fs'**
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\user\npm-debug.log
What i've done:
Uninstall node and reinstall it
Install a different version of node (7.7.0) and see if it updated npm
used npm clean cache -f
And none of these things worked...
So any ideas?
I had the same problem and had to run
npm install npm#latest -g
from the command line. I was told node and npm versions will be different.
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs

Error: EACCES: permission denied when trying to install ESLint using npm

I'm trying to install ESLint with npm by going:
npm install -g eslint
However I get the following error:
Deans-Air:~ deangibson$ npm install -g eslint
npm ERR! tar.unpack untar error /Users/deangibson/.npm/eslint/2.4.0/package.tgz
npm ERR! Darwin 15.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "eslint"
npm ERR! node v4.2.3
npm ERR! npm v2.14.7
npm ERR! path /usr/local/lib/node_modules/eslint
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/eslint'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/eslint']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules/eslint',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/eslint',
npm ERR! fstream_class: 'DirWriter',
npm ERR! fstream_stack:
npm ERR! [ '/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:35:25',
npm ERR! '/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:47:53',
npm ERR! 'FSReqWrap.oncomplete (fs.js:82:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/deangibson/npm-debug.log
And to be honest I get this every single time I try and install something with npm. Sometimes using 'sudo' works, sometimes it doesn't... How can I fix this once and for all?
Use --unsafe-perm=true and --allow-root flags with npm install like below:-
sudo npm install -g eslint --unsafe-perm=true --allow-root
it worked like charm for me.
This problem is well documented in the npm docs: Fixing npm permissions.
You have 2 solutions available:
Option 1: Change npm's default directory to a hidden directory in your home folder
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH
source ~/.profile
Option 2: Use a package manager that takes care of this for you
brew install node
Running the following command solved the issue for me while installing my packages.json :
sudo npm install --unsafe-perm=true --allow-root
To install only the package which caused the issue:
sudo npm install -g --unsafe-perm=true --allow-root eslint
sudo npm install -g --unsafe-perm=true eslint
is sufficient.
Use sudo before tns and it is work for me
Example:
sudo tns create Tekmo --template tns-template-hello-world
if I have used sudo then not found error like to create postinstall.js
Error: EACCES: permission denied
guys, I have fixed it simplely by
sudo npm install
I have tried the toppest answer, it works well too.
you can login as root using sudo su. First run the command sudo su on your terminal, then give your login password. Finally execute your expected command npm install -g eslint. It works for me.
For MAC user provide the access permission to project directory folder
Right click on project directory folder
Select get info
Provide the access permission - Apply to inclosed items
Just had the same error while running
npm install -g #ionic/cli native-run cordova-res
To fix, run the following
sudo apt update
sudo apt upgrade -y
I had read the already present solutions but thought there was something else, UNSAFE isn't a safe keyword, lol. While running the command with the --unsafe-perm=true, I noticed it downloading what seemed to be update binaries.
So, I updated and tried again.

Not able to install bower using npm on Ubuntu 13.04

I am not able to install bower.
Steps carried out :
Installed node.js (current stable version v0.10.12)
Installed npm using apt-get (v1.1.4)
Tried installing bower using :
npm install bower
I get the possible node.js incompatible error.
The weird thing is that the error log indicates that the script went to the node directory & tried node -v to get an old version of node.js (v0.6.19) though when I do so manually I get v.0.10.12.
Error Log :
npm http GET https://registry.npmjs.org/bower
npm ERR! Error: No compatible version found: bower
npm ERR! No valid targets found.
npm ERR! Perhaps not compatible with your version of node?
npm ERR! at installTargetsError (/usr/share/npm/lib/cache.js:488:10)
npm ERR! at next_ (/usr/share/npm/lib/cache.js:438:17)
npm ERR! at next (/usr/share/npm/lib/cache.js:415:44)
npm ERR! at /usr/share/npm/lib/cache.js:408:5
npm ERR! at saved (/usr/share/npm/lib/utils/npm-registry-client/get.js:147:7)
npm ERR! at Object.oncomplete (/usr/lib/nodejs/graceful-fs.js:230:7)
npm ERR! You may report this log at:
npm ERR! <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR! reportbug --attach /usr/share/node-v0.10.12/npm-debug.log npm
npm ERR!
npm ERR! System Linux 3.8.0-25-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "bower"
npm ERR! cwd /usr/share/node-v0.10.12
npm ERR! node -v v0.6.19
npm ERR! npm -v 1.1.4
npm ERR! message No compatible version found: bower
npm ERR! message No valid targets found.
npm ERR! message Perhaps not compatible with your version of node?
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /usr/share/node-v0.10.12/npm-debug.log
npm not ok
Need a way to install bower. Any ideas ?
I had the same issue on ubuntu 12.04 here is how I fixed it:
As GabLeRoux mentioned, Node version manager requires curl package to be installed and therefore you might need to install curl before:
sudo apt-get install curl -y
1) Clear NPM's cache:
sudo npm cache clean -f
2) Install a little helper called 'n' (node version manager)
sudo npm install -g n
3) Install latest stable NodeJS version
sudo n stable
4) Install Bower again
sudo npm install -g bower
Try this, because you must install it as superuser:
sudo npm install bower
You must type in your su password.
I recommend using the linux binary from nodejs.org. Available for both 32-bit and 64-bit versions and installs with NPM:
http://nodejs.org/download/
This should prevent any node/npm version conflicts.
For Cent OS users -
I first had to update NPM to get around this, and was getting errno 34 for bower on CentOS 7
sudo npm install -g npm
sudo npm install -g bower
If you get sudo npm command not found, you can edit /etc/sudoers to include npm bin path
Defaults secure_path = /sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin

Resources