create-react-app my-app failed -- Unexpected end of JSON input while parsing near '...22.1.0","jest-util":"'

Created on 29 May 2018  路  1Comment  路  Source: facebook/create-react-app

Is this a bug report?

Yes

Did you try recovering your dependencies?

No project directory created.

Which terms did you search for in User Guide?

None.

Environment

npx: installed 1 in 2.176s
Path must be a string. Received undefined
npx: installed 67 in 4.773s
C:\Users\Martin\AppData\Roaming\npm-cache_npx13704node_modules\create-react-app\index.js

Environment:
OS: Windows 7
Node: 6.9.5
Yarn: Not Found
npm: 6.1.0
Watchman: Not Found
Xcode: N/A
Android Studio: Not Found

ERROR: package.json not found!

Steps to Reproduce

npx create-react-app my-app

Expected Behavior

I expected it to create my-app directory.

Actual Behavior

D:\work\CLRVSN\projects>npx create-react-app my-app
npx: installed 1 in 2.481s
Path must be a string. Received undefined
npx: installed 67 in 6.55s
C:\Users\Martin\AppData\Roaming\npm-cache\_npx\12000\node_modules\create-react-app\index.js

Creating a new React app in D:\work\CLRVSN\projects\my-app.

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

npm ERR! Unexpected end of JSON input while parsing near '...22.1.0","jest-util":"'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Martin\AppData\Roaming\npm-cache\_logs\2018-05-29T16_12_43_855Z-debug.log

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

Deleting generated file... package.json
Deleting my-app / from D:\work\CLRVSN\projects
Done.

The end of the log file is:

2078 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...22.1.0","jest-util":"'
2078 verbose stack     at Object.parse (native)
2078 verbose stack     at parseJson (C:\Users\Martin\AppData\Roaming\npm\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
2078 verbose stack     at consumeBody.call.then.buffer (C:\Users\Martin\AppData\Roaming\npm\node_modules\npm\node_modules\pacote\node_modules\make-fetch-happen\node_modules\node-fetch-npm\src\body.js:96:50)
2078 verbose stack     at process._tickCallback (internal/process/next_tick.js:103:7)
2079 verbose cwd D:\work\CLRVSN\projects\my-app
2080 verbose Windows_NT 6.1.7601
2081 verbose argv "D:\\open\\nodejs\\node.exe" "C:\\Users\\Martin\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save" "--save-exact" "--loglevel" "error" "react" "react-dom" "react-scripts"
2082 verbose node v6.9.5
2083 verbose npm  v6.1.0
2084 error Unexpected end of JSON input while parsing near '...22.1.0","jest-util":"'
2085 verbose exit [ 1, true ]

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

Most helpful comment

I've managed to fix this by deleting everything from C:\Users\Martin\AppData\Roaming\npm-cache

>All comments

I've managed to fix this by deleting everything from C:\Users\Martin\AppData\Roaming\npm-cache

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wereHamster picture wereHamster  路  3Comments

xgqfrms-GitHub picture xgqfrms-GitHub  路  3Comments

alleroux picture alleroux  路  3Comments

oltsa picture oltsa  路  3Comments

adrice727 picture adrice727  路  3Comments