2
votes

windows 10 node v10.15.1 npm v6.8.0;

I:\>npx create-react-app newpomodoro

Creating a new React app in I:\newpomodoro.

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 '...:"^2.2.x","topo":"1.x'

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache_logs\2019-03-03T17_21_57_703Z-debug.log

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

Deleting generated file... package.json Deleting newpomodoro/ from I:\ Done.

I installed react globaly and loacaly as well but still it was giving me same error. Can anyBody tell me whats going wrong.

5

5 Answers

2
votes

Use this command:

npm cache clean --force
1
votes

I am having this same problem with npm install --save --save-exact --loglevel error react react-dom react-scripts has failed. Mine then deletes node_modules and package.json. I have asked about this here: NPX create-react-app aborting installation after vulnerabilities found

I have already tried to use npm cache clean --force but this has not solved the problem. I have also tried installing different versions of node.js to no avail.

0
votes

I ran into a similar issue. I don't know if you might have been in the same boat, but the cause was a space in my path name. I often save my projects on google file stream which has a space in the name ("G:/My Drive/..."). I tried creating the app in another directory and moving the folder which ended up working out.

0
votes

The command npm clean --cache won't help.

If you are facing an abort installation error in react.

The abort installation error generated because of the older node version. you should update your node package version.

To solve, run the following command and it will solve the abort installation error.

nvm install node 12.18.0

So, update your node package to the latest one. Once you've updated your node package then create your react app as follows:

npx create-react-app <your-app-name>

The abort installation error occurred because the outdated version of your node was not supporting the create-react-app command and deleted the node_modules and package.json file

Try this, please. It solved my error and hopefully, it'll solve your error too.

-2
votes

here is the solution which works for me, first of all, you should update all of your dependencies then ran the command

npm cache clean --force

after that you can use

npx create-react-app