3

I installed the latest version on Node JS with npm and cannot run create-react-app. The following problem occurs:

Creating a new React app in C:\wamp64\www\bob.

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 '....tgz"}},"2.3.4":{"nam'

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Ivana\AppData\Roaming\npm-cache_logs\2019-02-26T21_21_48_727Z-debug.log

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

Deleting generated file... package.json
Deleting bob/ from C:\wamp64\www
Done.

Versions:

Node v10.15.1
npm 6.7.0

Can somebody help?

After running npm cache clean --force

the another error occurs:

$ create-react-app bob

Creating a new React app in C:\Users\Ivana\bob.

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 '...,"@babel/plugin-synta'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Ivana\AppData\Roaming\npm-cache\_logs\2019-02-27T09_18_28_856Z-debug.log

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

Deleting generated file... package.json
Deleting bob/ from C:\Users\Ivana
Done.
7
  • 1
    Did you try purging mode_modules and installing dependencies from clean? Also in windows npm cache clean --force might help. Commented Feb 27, 2019 at 8:58
  • @emix what do you mean by deleting node_modules and installing dependencies from clean, how can I do that? Commented Feb 27, 2019 at 9:09
  • 1
    This is probably linked to this github issue, try npm cache clean --force Commented Feb 27, 2019 at 9:13
  • I tried with npm cache clean --force and the result is after: npm ERR! Unexpected end of JSON input while parsing near '...,"@babel/plugin-synta' npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Ivana\AppData\Roaming\npm-cache_logs\2019-02-27T09_18_28_856Z-debug.log Aborting installation. npm install --save --save-exact --loglevel error react react-dom react-scripts has failed. Deleting generated file... package.json Deleting bob/ from C:\Users\Ivana Done. Commented Feb 27, 2019 at 9:23
  • I mean delete the node_modules and npm install Commented Feb 27, 2019 at 9:44

4 Answers 4

9

From https://create-react-app.dev/docs/getting-started#creating-an-app

npx create-react-app my-app

(npx comes with npm 5.2+ and higher)

But you used

`create-react-app my-app`

If you use npm 5.1 or earlier, you can't use npx. Instead, install create-react-app globally:

npm install -g create-react-app

Now you can run:

create-react-app my-app
Sign up to request clarification or add additional context in comments.

1 Comment

After running npm cache clean --forcem i tried npx create-react-app my-app and it works voila :) Thanks, turchak
1

I was also not able to create a new app but when I follow these step then it works for me.

Comments

1

After a few searches, I found this :

If you've previously installed create-react-app globally via npm install -g create-react-app, we recommend you uninstall the package using npm uninstall -g create-react-app to ensure that npx always uses the latest version.

So if you installed create-react-app with

npm -g install create-react-app

just run :

npm -g uninstall create-react-app npx create-react-app

It should do the job

1 Comment

This answer worked best for me, also I didn't clean my cache but instead, I typed: npm cache verify.
0

I was able to solve this problem by,

running

npm cache clean --force

then

npm create-react-app my-app

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.