HomeTutorsContact

(Solved) Unexpected end of JSON input while parsing near '...'?

By Gulshan Saini
Published in NodeJS
August 20, 2020
1 min read

3 ways to solve below error while creating a new React app. This issue basically happens due to corrupt npm cache

Error

npm ERR! Unexpected end of JSON input while parsing near ‘…IQm+fFFJjZGEbtrZiQZGt’

npm init react-app front
npx: installed 98 in 37.068s

Creating a new React app in /Users/gulshansaini/personal/chatters/client.

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 '...IQm+fFFJjZGEbtrZiQZGt'

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/gulshansaini/.npm/_logs/2020-08-20T20_44_49_139Z-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 /Users/gulshansaini/personal/chatters
Done.

Solution 1 - Delete npm cache

Clean npm cache by running npm cache clean --force

Solution 2 - remove .npm directory

Go to home directory for your operating system and delete .npm folder

rm -f ~/.npm

Solution 3 - Use Yarn instead

If above two solutions do not work for you, create react app using Yarn

npm i -g yarn

After, fixing the problematic npm cache try running again npx create-react-app client


Tags

#react#npm
Previous Article
How to create isolated Python virtual environment?

Related Posts

NodeJS
How to list the installed node modules and their dependencies?
August 15, 2020
1 min
Gulshan Saini

Gulshan Saini

Fullstack Developer

Topics

Flutter
JavaScript
NextJS
ReactJS
Typescript

Subscribe to our newsletter!

We'll send you the best of our blog just once a month. We promise.
© 2021, All Rights Reserved.

Quick Links

Contact UsBrowserCSSPythonPuppeteer

Social Media