create-react-app : npm ERR!解析“....”附近时 JSON 输入意外结束

Hak*_*lla 6 ubuntu npm reactjs npx

描述错误

npx create-react-app my-app对我不起作用,我试过了,npm cache clean --force但我一次又一次地得到同样的错误

重现步骤

  1. npm cache clean --force
  2. 每日下午 / npx create-react-app front
npm init react-app front
npx: installed 98 in 37.068s

Creating a new React app in /home/h4kst3r/Desktop/APIs/restaurant-API/front.

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 '...zAJNgZjZUkJ08ybAxwNnR'

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/h4kst3r/.npm/_logs/2020-05-20T20_47_49_189Z-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 /home/h4kst3r/Desktop/APIs/restaurant-API
Done.
Run Code Online (Sandbox Code Playgroud)

系统:

操作系统:Linux 5.4 Ubuntu 20.04 LTS (Focal Fossa)

小智 8

它的发生是因为互联网速度慢。所以等到你的互联网连接正常。或者一一安装所有依赖项。