Hakim Bencella
Hakim Bencella

Reputation: 326

create-react-app : npm ERR! Unexpected end of JSON input while parsing near '....'

Describe the bug

npx create-react-app my-app doesn't work for me i tried npm cache clean --force but i get the same error again and again

Steps to reproduce

  1. npm cache clean --force
  2. npm / npx create-react-app front
npm init react-app front
npx: installed 98 in 37.068s

Creating a new React app in /home/h4kst3r/Desktop/APIs/restaurant-API/front.

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

npm ERR! Unexpected end of JSON input while parsing near '...zAJNgZjZUkJ08ybAxwNnR'

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/h4kst3r/.npm/_logs/2020-05-20T20_47_49_189Z-debug.log

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

Deleting generated file... package.json
Deleting front/ from /home/h4kst3r/Desktop/APIs/restaurant-API
Done.

System:

OS: Linux 5.4 Ubuntu 20.04 LTS (Focal Fossa)

Upvotes: 6

Views: 9548

Answers (5)

P-God Emmanuel
P-God Emmanuel

Reputation: 59

There are probably two things that can be at fault.

  1. Poor internet connection.
  2. outdated npm version.

update your npm and seek a strong internet connection.

Upvotes: 0

Hardik Satasiya
Hardik Satasiya

Reputation: 21

If npx create-react-app my-app command not working and throws an error like: npm ERR! Unexpected end of JSON input while parsing near '...zAJNgZjZUkJ08ybAxwNnR', Just check your npm version:

npm --version 
npm -v

and if required update it:

npm install -g npm@latest

It will definitely work.

Upvotes: 2

Sandesh Dinkar
Sandesh Dinkar

Reputation: 1

sudo npm i -g npx --force worked for me.

Upvotes: 0

Abu Darda
Abu Darda

Reputation: 126

Its happened because of slow internet . So wait till ur internet connection is normal. Or install all dependencies one by one .

Upvotes: 9

Vinay Kashyap
Vinay Kashyap

Reputation: 101

First check for npm version by running the following command npm --version. if you have an npm version then try instally npx globally with the help of npm i -g npx. if npm and ngx are installed properlly then this will work .

Upvotes: 1

Related Questions