npm Community Forum (Archive)

The npm community forum has been discontinued.

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

Trouble to run create-react-app

What I Wanted to Do

I am trying running the command “create-react-app hello”

What Happened Instead

It shows the following:
Unhandled rejection Error: EACCES: permission denied, open ‘/home/tony/.npm/_cacache/index-v5/5a/3e/1a8f854030772c8470c816b5f4033ac3bed08793801cf2b9dd39a340d104’

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:
npm ERR! /home/tony/.npm/_logs/2019-02-15T03_09_15_782Z-debug.log
Aborting installation.

npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.

Reproduction Steps

tony@tony-Lemur:~/Documents/react$ npm install -ed
npm WARN saveError ENOENT: no such file or directory, open ‘/home/tony/Documents/react/package.json’
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open ‘/home/tony/Documents/react/package.json’
npm WARN react No description
npm WARN react No repository field.
npm WARN react No README data
npm WARN react No license field.


I copied the last couple lines of logs here.
1659 silly pacote version manifest for doctrine@1.5.0 fetched in 34ms
1660 silly resolveWithNewModule doctrine@1.5.0 checking installable status
1661 silly pacote range manifest for read-pkg-up@^2.0.0 fetched in 97ms
1662 silly resolveWithNewModule read-pkg-up@2.0.0 checking installable status
1663 http fetch GET 304 138ms (from cache)
1664 silly pacote range manifest for eslint-import-resolver-node@^0.3.1 fetched in 172ms
1665 silly resolveWithNewModule eslint-import-resolver-node@0.3.2 checking installable status
1666 http fetch GET 304 177ms (from cache)
1667 silly pacote range manifest for eslint-module-utils@^2.2.0 fetched in 197ms
1668 silly resolveWithNewModule eslint-module-utils@2.3.0 checking installable status
1669 timing npm Completed in 37982ms
1670 error cb() never called!
1671 error This is an error with npm itself. Please report this error at:
1672 error

Platform Info

cat /etc/os-release
VERSION=“18.04.1 LTS (Bionic Beaver)”
PRETTY_NAME=“Ubuntu 18.04.1 LTS”

$ npm --versions
{ npm: '6.7.0',
  ares: '1.14.0',
  cldr: '32.0.1',
  http_parser: '2.7.1',
  icu: '60.2',
  modules: '57',
  nghttp2: '1.30.0',
  node: '8.10.0',
  openssl: '1.1.0g',
  tz: '2017c',
  unicode: '10.0',
  uv: '1.18.0',
  v8: '6.2.414.50',
  zlib: '1.2.11' }

$ node -p process.platform

Based on the EACCES error you showed, do you install global npm modules using sudo?

If so, the problem may be due to some broken permissions/ownership left behind. The open issue is: Global installs (sudo npm i -g) fail on Mac after 6.5 upgrade. Works fine after 6.4.1 downgrade.

The quick fix to try is to reset the ownership on files in the affected folder, then try your command again:

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

(I am not clear from your reproduction steps whether this is a good explanation, and someone else may suggest a different cause and things to try.)

Thanks John. It works now.