EACCES: permission denied - react-native-cli

(Guilherme Fernandes) #1

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


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

VERSION=β€œ18.04.1 LTS (Bionic Beaver)”
PRETTY_NAME=β€œUbuntu 18.04.1 LTS”

$ 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: β€˜’,
zlib: β€˜1.2.11’ }

$ node -p process.platform

(John Gee) #2

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.

(system) closed #3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.