npm Community Forum (Archive)

The npm community forum has been discontinued.

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

create-react-app: cb() never called

What I Wanted to Do

Create a react app

What Happened Instead

It started installing some of the node modules but then it ran into this error

Reproduction Steps

npx create-react-app


2019-09-20T00_43_12_235Z-debug.log (15.7 KB)

Platform Info

$ npm --versions
npm: '6.9.0',
  ares: '1.15.0',
  brotli: '1.0.7',
  cldr: '35.1',
  http_parser: '2.8.0',
  icu: '64.2',
  modules: '64',
  napi: '4',
  nghttp2: '1.39.2',
  node: '10.16.3',
  openssl: '1.1.1c',
  tz: '2019a',
  unicode: '12.1',
  uv: '1.28.0',
  v8: '',
  zlib: '1.2.11'
$ node -p process.platform

was caused because there was an "Unhandled rejection Error: EACCES: permission denied, mkdir '/home//.npm/_cache/index-<…>/

solved problem by just adding “sudo” in front

sudo npx create-react-app .

Note that there were some problems with file ownership being broken by past uses of sudo with global installs. This was fixed in: Release: 6.10.2

The quick fix is:

sudo chown -R $USER ~/.npm

(Sticking sudo in front of your project creation may lead to more ownership problems if the new project is then owned by root…)

Thanks for letting me know. Is there a way to check and change the global username? do you think that’ll prevent future problems like this from happening

The high level ways of avoiding the use of sudo for global installs are:

However, the simplest was to prevent future problems like this from happening is to update npm! The bug has been fixed.