NodeJS
How to list the installed node modules and their dependencies?
August 15, 2020
1 min
3 ways to solve below error while creating a new React app. This issue basically happens due to corrupt npm cache
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.
Clean npm cache by running npm cache clean --force
Go to home
directory for your operating system and delete .npm
folder
rm -f ~/.npm
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