Search code examples
reactjscreate-react-appubuntu-18.04

I am trying to start a new react project But I am getting this error and the app is not created. I have installed react globally


enter image description here(base) mukund@mukund-Inspiron-15-3567:~$ create-react-app todo-app

Creating a new React app in /home/mukund/todo-app.

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 '...{"babel-core":"^6.0.0'

npm ERR! A complete log of this run can be found in: npm ERR! /home/mukund/.npm/_logs/2020-05-10T14_41_17_724Z-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 todo-app/ from /home/mukund Done.


Solution

  • Creating an app like the recommended way by the core React team at reactjs.org should solve the problem.

    Do this:

    npx create-react-app todo-app
    

    If that is still not working then run the following to clear your npm cache before trying the step above again:

    npm cache clean --force 
    

    This just gives you a clean reset incase your cached modules are conflicting with each other.