First install the latest version of node and npm
$ curl -sL https://deb.nodesource.com/setup_10.x | sudo bash - $ sudo apt-get install -y nodejs
the latest npm version now 6.9.0 , check npm version with npm --version if npm version - 6.4.1 just update npm first
$ npm install -g npm
If you have permission issues caused by sudo , then you can cd in .npm-global
$ cd /home/user_home_directory/.npm-global/
using the chmod to change permissions on all files and directories in this folder:
$ sudo chmod 777 * -R
After installation, you should add this line to the end of the .bashrc :
export PATH="/home/user_home_directory/.npm-global/bin:$PATH"
After saving .bashrc only source it
$ source .bashrc
After everything is done, you can install electron globally
$ npm install -g electron
source share