fail to install electron in ubuntu - node.js

I followed the command 'npm install -g electron', the command line gives me back an error 'EACCES:permission denied, mkdir /usr/local/lib/node_modules/electron/.electron'
I tried to give permission by 'chown -R root /usr/local/lib/node_modules/*', but still doen't work?
anyone seen the problem before?
solved:
at last I found you can install it directly without root or sudo

If you are using the -g flag for global, you have to either run the command as the root user or invoke the command with sudo
sudo npm install -g electron

Related

How to reverse "sudo chown -R 501:20"

Ran npm i -g {library} inside my project and npm gave me an error because I didnt use sudo. instead of using sudo on a second attempt, I followed npm's suggestion to run sudo chown -R 501:20 "/Users/vorousjames/.npm" (inside my project).
now anytime I run an npm command (anywhere), I get bash: /Users/vorousjames/.npm-global/bin/npm: No such file or directory
How do I fix this so I can use npm again?
try running this in the terminal
export PATH="/Users/vorousjames/.npm:$PATH
if it works add that to your .bash_profile

Install reactjs on ubuntu 18.04

Node
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
sudo apt-get install -y nodejs
npm 5.3+
sudo npm install npm#latest -g
Create-React-App
npm install -g create-react-app
create-react-app memory
When i enter "npm start", the application does not open on the browser and I can not access it via the url my.ip.public:3000.
I disabled the firewall, it does not solve the problem. I granted another port via an .env file, it did not solve the problem.
It is not a question of duplication because on the link the command "npm start" does not produce any effect, with me everything seems correct at the level of the command line ... besides, I tried the solution of your link but that does not solve the problem, it makes it worse.
This will generate an error like Error: EACCES: permission denied, access '/usr/local/lib/node_modules' react
You need a superuser privilege to install react. To get superuser privilege simply run
sudo -i
command before the command npm install -g create-react-app
I was having problems with this also but here is what worked for me
Make sure you have npm installed or use:
sudo apt install npm
Then
sudo npm -g install create-react-app
after that I used this for creating an app (don't use npm followed by the rest, instead us as follows):
create-react-app nameofyourapp
That worked for me.

getting error when using -g in npm

when I try to install any package globally, I get multiple errors. have a look at the image
the errors in the terminal
Thanks all.
When you install any global package just add sudo prefix. sudo npm install -g express
If you want to install packages globally with the "g"-parameter you must be root.
It's easy to just run sudo npm install -g express to successfully install express.
But a long time solution for the permission access, run chown -R YOUR_USERNAME /usr/lib/node_modules from your terminal so that you will not have to include sudo in your subsequent installation using -g

Fix for npm global install on Ubuntu

I have a nodejs package that requires a global install. This one fails in a way that leads me to believe there might be a configuration problem in the the Ubuntu package npm. This happens every-time I setup an Ubuntu 14.04 machine.
sudo apt-get install npm
npm install -g lineman
The npm -g command will throw some access error naming the local lib and bin directories. Unlike some global installs, it is not an option to cheat and run the second command under sudo. So, the only fix I have found that will work is something like this:
sudo chgrp -R $(whoami) /usr/local/bin /usr/local/lib
sudo chmod -R g+rwx /usr/local/bin /usr/local/lib
The fix is fine for me, I'm the only user. But is this really the best way to do it? I don't want to document my fix for anyone else that might use it in an environment where this will not work or cause trouble.
Also, should I file a bug report with someone who packages npm for Ubuntu?
Instead of npm install -g lineman, you should run sudo npm install -g lineman. npm requires permission as well.
Also check this stackoverlfow link.

Trouble installing towerjs on ubuntu

I keep getting this error when the towerjs post install script runs
npm ERR! Error: EACCES, open '/home/claire/.npm/e18f6569-thub-com-viatropos-coffeecup-git.lock'
I've tried sudo, and -g but I think it's because the post install script doesn't include sudo. I can install coffeecup on its own, but the tower sub install fails.
Login with root to finish installation correctly.
For Ubuntu:
Set root password if it not defined yet:
sudo passwd
Change user to root
su
Install tower
npm install tower -g
This way works for me.
Note: not work if you change user to root with sudo -s command. Works only with su.

Resources