npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

Trying to install Knex (Error)

For some reason, I don’t know why but when I try to run the command npm install knex --save in my terminal, the following error appears on my terminal:

Unhandled rejection Error: EACCES: permission denied, rename ‘/Users/ngapeitamatehaereleilua-gotz/.npm/_cacache/tmp/3f921574’ -> ‘/Users/ngapeitamatehaereleilua-gotz/.npm/_cacache/content-v2/sha512/2a/89/271ede96d0a7ba09131c0b1aff29596d60d31ff27b33259d3081ab3aea06b2d96a9340ddebe2803e14b57254404ff6a098d392c3a46583ca677239f653c0’

npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!

npm ERR! A complete log of this run can be found in:

I am guessing you are running a recent version of npm, and use sudo when you install global modules? There are some open issues about permission and ownership issues for this combination.

Try resetting ownership with:

sudo chown -R $(whoami) ~/.npm

and then bring the install again.