我使用的是Ubuntu 20.04。我已经尝试使用npx运行create react应用程序超过2天了,切换到不同的Wifis +以太网,但我一直收到Invalid json response body at https://registry.npmjs.org/loose-envify。
我以为是网速问题,但事实并非如此
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! code FETCH_ERROR
npm ERR! errno FETCH_ERROR
npm ERR! invalid json response body at https://registry.npmjs.org/loose-envify reason: Unexpected end of JSON input
npm ERR! A complete log of this run can be found in:
npm ERR! /home/deestarks/.npm/_logs/2021-04-12T18_55_27_266Z-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发布于 2021-07-15 02:25:35
我在这里解决了类似的问题:npm install failed, npm ERR! invalid json response
npm cache clean --force和
npm cache verify然后
npm i npm@latest -g最后,我能够跑起来
npm i类似的问题也在那里:npm ERR! Unexpected end of JSON input while parsing near '...registry.npmjs.org/@i'
发布于 2021-05-01 13:34:17
运行此命令,它将解决您的问题
sudo npm cache clean --forcehttps://stackoverflow.com/questions/67064426
复制相似问题