npm Community Forum (Archive)

The npm community forum has been discontinued.

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

Was instructed by error message to contact npm community. create-react-app failed. Why?

MacBook-Pro:desktop dalefrancis$ create-react-app react-is-fun

Creating a new React app in /Users/dalefrancis/Desktop/react-is-fun.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts…

Unhandled rejection Error: EACCES: permission denied, mkdir ‘/Users/dalefrancis/.npm/_cacache/index-v5/dc/f5’

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! /Users/dalefrancis/.npm/_logs/2019-07-11T00_38_35_689Z-debug.log

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

Deleting generated file… package.json
Deleting react-is-fun/ from /Users/dalefrancis/Desktop
MacBook-Pro:desktop dalefrancis$

What version of node are you running?

node --version

I figured it out. I needed to run the command as sudo. Thx.

(You should not need to run that command with sudo, and might run into some further file ownership issues with files and folder owned by root. But good that you are unblocked for now!)