npm Community Forum (Archive)

The npm community forum has been discontinued.

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

NPM not updating in Mojave

Hi all!

anyone knows how to fix the error while updating NPM in mojave?

Unhandled rejection Error: EACCES: permission denied, mkdir '/Users/.npm/_cacache/index- 

npm ERR! cb() never called!


There are different problems which cause errors in .npm cache folder, so getting some more information…

What command are you running? (Including the sudo if you are using sudo.)

What version of node are you using?

Did you edit the path in the error message to remove your username? (Checking because the path looks a big unusual otherwise!)

command: npm install plotly.js-dist
version: react-4.3.0
yes, removed my user name before posting.

There is an open issue with installing global packages using sudo leaving behind files with the wrong ownership.

The short version is run this to fix the ownership, then try your install again:

sudo chown -R $(whoami) ~/.npm
npm install plotly.js-dist

thanks for quick response!
this is what i got:
(base) mbp-2:~ Luchano$ sudo chown -R (whoami) ~/.npm (base) mbp-2:~ Luchano npm install plotly.js-dist
npm WARN saveError ENOENT: no such file or directory, open ‘/Users/package.json’
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/package.json’
npm WARN No description
npm WARN No repository field.
npm WARN No README data
npm WARN No license field.
+ plotly.js-dist@1.48.3
updated 1 package and audited 20723 packages in 3.524s
found 106 vulnerabilities (101 moderate, 5 high)
run npm audit fix to fix them, or npm audit for details

Oh, my intention was to run the install from the same package/directory you were originally trying to run it:

cd your-project-folder
npm install plotly.js-dist

Those error messages look like you are running the command in your home folder, rather than in your package directory.

thanks! i’ll give it a go