Create-react-app: Error running the following command: npx create-react-app my-app

Created on 6 Jun 2018  Β·  5Comments  Β·  Source: facebook/create-react-app

Issue

I'm running the following command
npx create-react-app my-app
And I'm getting an error. I'll post the error at the bottom.

I checked the Troubleshooting docs https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#troubleshooting
and Stack Overflow, only solution I tried is running the command:
npm install -g create-react-app
create-react-app my-app

Which gave me another error.

I will admit, I'm not able to decipher the error message.

Feel free to contact me if you need additional information.

Environment

By running: npx create-react-app --info

Environment:
OS: macOS High Sierra 10.13.4
Node: 9.5.0
Yarn: Not Found
npm: 6.0.0
Watchman: Not Found
Xcode: Xcode 9.4 Build version 9F1027a
Android Studio: Not Found

Error Message - Terminal Output

frankcarloneiii react $ pwd
/Users/frankcarloneiii/Documents/coding/react
frankcarloneiii react $ npx create-react-app my-app

Creating a new React app in /Users/frankcarloneiii/Documents/coding/react/my-app.

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

events.js:137β–‘β–‘β–‘β–‘β–‘β–‘βΈ© ⠏ extract:js-yaml: sill extract [email protected]
      throw er; // Unhandled 'error' event
      ^

Error [ERR_STREAM_WRITE_AFTER_END]: write after end
    at writeAfterEnd (_stream_writable.js:237:12)
    at PassThrough.Writable.write (_stream_writable.js:287:5)
    at PassThrough.Writable.end (_stream_writable.js:573:10)
    at ReadEntry.entry.on (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/extract-stream.js:19:41)
    at ReadEntry.emit (events.js:165:20)
    at ReadEntry.emit (/usr/local/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:296:25)
    at ReadEntry.[maybeEmitEnd] (/usr/local/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:249:12)
    at ReadEntry.end (/usr/local/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:162:27)
    at Unpack.[consumeBody] (/usr/local/lib/node_modules/npm/node_modules/tar/lib/parse.js:210:13)
    at Unpack.[consumeChunkSub] (/usr/local/lib/node_modules/npm/node_modules/tar/lib/parse.js:391:40)
    at Unpack.[consumeChunk] (/usr/local/lib/node_modules/npm/node_modules/tar/lib/parse.js:362:30)
    at Unzip.(anonymous function).on.chunk (/usr/local/lib/node_modules/npm/node_modules/tar/lib/parse.js:291:59)
    at Unzip.emit (events.js:160:13)
    at Unzip.emit (/usr/local/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:296:25)
    at Unzip.write (/usr/local/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:99:17)
    at Unzip.write (/usr/local/lib/node_modules/npm/node_modules/tar/node_modules/minizlib/index.js:284:29)
events.js:137β–‘β–‘β–‘β–‘β–‘β–‘βΈ© β ΄ extract:resolve-cwd: sill extract [email protected]
      throw er; // Unhandled 'error' event
      ^

Error [ERR_STREAM_WRITE_AFTER_END]: write after end
    at writeAfterEnd (_stream_writable.js:237:12)
    at PassThrough.Writable.write (_stream_writable.js:287:5)
    at PassThrough.Writable.end (_stream_writable.js:573:10)
    at ReadEntry.entry.on (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/extract-stream.js:19:41)
    at ReadEntry.emit (events.js:165:20)
    at ReadEntry.emit (/usr/local/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:296:25)
    at ReadEntry.[maybeEmitEnd] (/usr/local/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:249:12)
    at ReadEntry.end (/usr/local/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:162:27)
    at Unpack.[consumeBody] (/usr/local/lib/node_modules/npm/node_modules/tar/lib/parse.js:210:13)
    at Unpack.[consumeChunkSub] (/usr/local/lib/node_modules/npm/node_modules/tar/lib/parse.js:391:40)
    at Unpack.[consumeChunk] (/usr/local/lib/node_modules/npm/node_modules/tar/lib/parse.js:362:30)
    at Unzip.(anonymous function).on.chunk (/usr/local/lib/node_modules/npm/node_modules/tar/lib/parse.js:291:59)
    at Unzip.emit (events.js:160:13)
    at Unzip.emit (/usr/local/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:296:25)
    at Unzip.write (/usr/local/lib/node_modules/npm/node_modules/tar/node_modules/minipass/index.js:99:17)
    at Unzip.write (/usr/local/lib/node_modules/npm/node_modules/tar/node_modules/minizlib/index.js:284:29)
npm ERR! cancel after 1 retries!

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/frankcarloneiii/.npm/_logs/2018-06-06T18_07_11_474Z-debug.log

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

Deleting generated file... node_modules
Deleting generated file... package.json
Deleting my-app / from /Users/frankcarloneiii/Documents/coding/react
Done.
frankcarloneiii react $ npx create-react-app --info

Environment:
  OS:  macOS High Sierra 10.13.4
  Node:  9.5.0
  Yarn:  Not Found
  npm:  6.0.0
  Watchman:  Not Found
  Xcode:  Xcode 9.4 Build version 9F1027a
  Android Studio:  Not Found

ERROR: package.json not found!

frankcarloneiii react $

Most helpful comment

I may have found a solution via https://github.com/facebook/create-react-app/issues/4478
The following command worked for me: npm create react-app my-app

Thanks @legodude17

All 5 comments

I may have found a solution via https://github.com/facebook/create-react-app/issues/4478
The following command worked for me: npm create react-app my-app

Thanks @legodude17

I ran into the same issue with npx create-react-app myapp
Iget an aborting installation it works sometimes then others fails.

I'm sorry I don't get it. How do I fix same issue?
I have tried npm create-react-app my-app and also npx
error
create-react-app my-app

I am able to create successfully with following command: Please correct your command with

npm create react-app my-app (no hyphen after create)

Hi @Felix-okeff and @Indira-cit,

Please use one of the following methods to initialise:

npx create-react-app [app-name]
npm init react-app [app-name] # Which calls `npx create-react-app [app-name]`
yarn create react-app [app-name]

Note that you can also pass in --typescript to initialise with TypeScript.

npx create-react-app [app-name] --typescript

If the above are not working, please ensure you have the latest versions of npm and/or yarn installed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fson picture fson  Β·  3Comments

DaveLindberg picture DaveLindberg  Β·  3Comments

AlexeyRyashencev picture AlexeyRyashencev  Β·  3Comments

xgqfrms-GitHub picture xgqfrms-GitHub  Β·  3Comments

adrice727 picture adrice727  Β·  3Comments