【发布时间】:2020-09-07 10:44:06
【问题描述】:
描述错误
npx create-react-app my-app 不适合我
我试过npm cache clean --force,但我一次又一次地得到同样的错误
重现步骤
npm cache clean --force- npm /
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.
系统:
操作系统:Linux 5.4 Ubuntu 20.04 LTS(Focal Fossa)
【问题讨论】:
-
你使用的是哪个 npm 版本?
-
@FarhaniWalid 6.12.0
-
尝试从头开始重新安装它们,看看它是否会解决问题,基本上你得到的错误是由这些软件包之一引发的,或者这可能是由你拥有的权限引起的,先试试 sudo npx create-react-app front