question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

can not create react app Unexpected end of JSON input while parsing near '...webpack-dev-middlewar'

See original GitHub issue

Is this a bug report?

(write your answer here) yes

Did you try recovering your dependencies?

(Write your answer here.) There is actually no package.json preinstalled .

Which terms did you search for in User Guide?

(Write your answer here if relevant.)

Environment

(paste the output of the command here) $ npx create-react-app react-spa-demo npx: 91 安装成功,用时 46.343 秒

Creating a new React app in D:\WebstormProjects\react-spa-demo.

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 ‘…webpack-dev-middlewar’

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\lenovo\AppData\Roaming\npm-cache_logs\2019-06-22T07_18_33_539Z-debug.log

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

Deleting generated file… package.json Deleting react-spa-demo/ from D:\WebstormProjects Done.

Steps to Reproduce

(Write your steps here:)

  1. npx create-react-app react-spa-demo

Expected Behavior

(Write what you thought would happen.) create this app successfully without exceptions

Actual Behavior

(Write what happened. Please add screenshots!) $ npx create-react-app react-spa-demo npx: 91 安装成功,用时 46.343 秒

Creating a new React app in D:\WebstormProjects\react-spa-demo.

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 ‘…webpack-dev-middlewar’

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\lenovo\AppData\Roaming\npm-cache_logs\2019-06-22T07_18_33_539Z-debug.log

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

Deleting generated file… package.json Deleting react-spa-demo/ from D:\WebstormProjects Done.

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:56 (1 by maintainers)

github_iconTop GitHub Comments

159reactions
mrmckebcommented, Jun 23, 2019

Hi @Evan-Tsai17, can you please try running npm cache clean --force, and then try again?

I think this is a local caching issue.

16reactions
Cavdycommented, Sep 22, 2019

Hi @Evan-Tsai17, can you please try running npm cache clean --force, and then try again?

I think this is a local caching issue.

This worked for me. Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

create-react-app : npm ERR! Unexpected end of JSON input ...
If npx create-react-app my-app command not working and throws an error like: npm ERR! Unexpected end of JSON input while parsing near '....
Read more >
npm ERR! Unexpected end of JSON input while parsing near '....'
Describe the bug npm/npx create-react-app my-app show this error i tried npm cache clean --force but i get the same error again and...
Read more >
npm ERR! Unexpected end of JSON input while parsing near
I'm a windows user n got the above error while running create-react-app on my terminal. After deleting everything in npm-cache, then ran npm ......
Read more >
(Solved) Unexpected end of JSON input while parsing near '...'?
3 ways to solve below error while creating a new React app. This issue basically happens due to corrupt npm cache ...
Read more >
ERR! Unexpected end of JSON input while parsing near '…'
There are many causes of this error. But the core issue is the same, corrupted NPM packages. Here are possible solutions:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found