Ask Your Question
0

NPM command as root user not found

asked 2013-02-25 21:36:48 -0500

Marc_Boisvert gravatar image

I'm trying to install Yeoman et al from http://yeoman.io and right now have NodeJS / npm installed. The problem is when I want to install something with sudo npm install -g package I get bash: npm: command not found....

Now, when I run it without sudo it does work but complains because it doesn't have access / can't install without sudo.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2013-02-25 22:20:12 -0500

Marc_Boisvert gravatar image

updated 2013-02-26 06:49:55 -0500

hhlp gravatar image

So I found a fix:

Start by installing NodeJS and then:

 sudo ln -s /usr/local/bin/node /usr/bin/node
 sudo ln -s /usr/local/lib/node /usr/lib/node
 sudo ln -s /usr/local/bin/npm /usr/bin/npm
 sudo ln -s /usr/local/bin/node-waf /usr/bin/node-waf
edit flag offensive delete link more

Comments

1

Worth mentioning that NodeJS will be available in the fedora repositories from Fedora 19. It's a feature for Fedora 19.

FranciscoD_ gravatar imageFranciscoD_ ( 2013-02-26 07:08:29 -0500 )edit

Also, you could add /usr/local/bin to your PATH instead of making symlinks. (Your symlinks may break if you update the system etc.)

FranciscoD_ gravatar imageFranciscoD_ ( 2013-02-26 07:09:27 -0500 )edit
0

answered 2013-05-31 03:23:27 -0500

nebjak gravatar image

add this line to /etc/sudoers at the end of Defaults specification

Defaults    !secure_path
edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-02-25 21:36:48 -0500

Seen: 12,962 times

Last updated: May 31 '13