NPM always ask me for root in a Express project NPM always ask me for root in a Express project express express

NPM always ask me for root in a Express project


This is probably a permissions issue. To reclaim ownership of the /Users/Arnaud/.npm directory execute the following command in the terminal

chown -R Arnaud /Users/Arnaud/.npm

If you are on OSX you can also use Disk Utility to repair permissions across the entire disk, which will probably fix the issue for you as well.


If your using a MAC OS or a Unix/Lunix machine, you just need to be aware that for a security measure even if your to root owner you need to use the sudo command on the command line in the terminal. So changing ownership of files and directories is not enough with chown command most of time.

The reason is that the command you will execute will have big changes on system files and you need to enter the password of your root admin, just like in Windows when they ask you to enter the administrator password for system changes, so it will look like this:

*Ms-MacBook-Pro:~ AMB$ sudo npm install -g express-generator

Password: (ENTER YOUR PASSWORD FOR THE ROOT/ADMINISTRATOR)

/usr/local/bin/express -> /usr/local/lib/node_modules/express-generator/bin/express-cli.js/usr/local/lib└─┬ express-generator@4.15.0   ├─┬ commander@2.9.0   │ └── graceful-readlink@1.0.1   ├── ejs@2.5.6   ├─┬ mkdirp@0.5.1   │ └── minimist@0.0.8   └── sorted-object@2.0.1 

Ms-MacBook-Pro:~ AMB$*