npm Community Forum (Archive)

The npm community forum has been discontinued.

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

EACCES: permission denied - react-native-cli

What I Wanted to Do

install react-native-cli

What Happened Instead

Unhandled rejection Error: EACCES: permission denied, open ‘/home/guilherme/.npm/_cacache/tmp/fdbe7753’

npm ERR! cb() never called!

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

npm ERR! A complete log of this run can be found in:
npm ERR! /home/guilherme/.npm/_logs/2019-02-17T13_07_07_237Z-debug.log

Reproduction Steps

$ npm install -g react-native-cli

Details

0 info it worked if it ends with ok
1 verbose cli [ ‘/usr/bin/node’,
1 verbose cli ‘/usr/bin/npm’,
1 verbose cli ‘install’,
1 verbose cli ‘-g’,
1 verbose cli ‘react-native-cli’ ]
2 info using npm@6.4.1
3 info using node@v10.15.1
4 verbose npm-session 7421747a2a138bd6
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 timing npm Completed in 581ms
8 error cb() never called!
9 error This is an error with npm itself. Please report this error at:
10 error https://npm.community

Platform Info

NAME=“Ubuntu”
VERSION=“18.04.1 LTS (Bionic Beaver)”
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME=“Ubuntu 18.04.1 LTS”
VERSION_ID=“18.04”

$ npm --versions

{ npm: ‘6.4.1’,
ares: ‘1.15.0’,
cldr: ‘33.1’,
http_parser: ‘2.8.0’,
icu: ‘62.1’,
modules: ‘64’,
napi: ‘3’,
nghttp2: ‘1.34.0’,
node: ‘10.15.1’,
openssl: ‘1.1.0j’,
tz: ‘2018e’,
unicode: ‘11.0’,
uv: ‘1.23.2’,
v8: ‘6.8.275.32-node.12’,
zlib: ‘1.2.11’ }

$ node -p process.platform
linux


This may be due to some past use of sudo to install a global package. I suggest you reset ownership of your local cache folder, then try running the command again:

sudo chown -R $(whoami) ~/.npm
npm install -g react-native-cli

This issue is much more likely to occur with recent versions of npm, and the canonical bug and work-around is: Global installs (sudo npm i -g) fail on Mac after 6.5 upgrade. Works fine after 6.4.1 downgrade.