npm will not install express?

Solution 1:

I had the same problem, and npm cache clear did not fix it. This problem is caused because the .npm directory in your home directory was created with root privileges. Most likely the first npm command you ran was sudo npm -g and now you are trying to npm install in a local directory.

To solve:

  • sudo chown -R yourusername ~/.npm
  • This may not be necessary but I also had to rmdir ~/tmp

npm install from package.json should work after this.

Solution 2:

run npm cache clean and try to install it again

Solution 3:

i got the same problem , This problem is caused because the .npm directory in your home directory was created with root privileges.

use :

$sudo npm install -g express