问题:使用create-react-app初始化react项目报错。
首先yarn add global create-react-app,
然后新建文件夹执行npx create-react-app my-app。开始报错,
报错信息如下:
然后开始react官网,github上开始寻找解决办法…
终于https://create-react-app.dev/docs/getting-started上看到一句话,
大概就是在此之前你执行过create-react-app的命令的话,建议你全局卸载下,确保npx是最新版本。
我抱着试一试的心态,执行yarn global remove create-react-app将其卸载,然后执行yarn add global create-react-app重新安装了一次,最后找了个文件夹执行npx create-react-app my-app,成功!!!
npx create-react-app my-app搭建React脚手架报错,npm ERR! Unexpected end of JSON input while parsing near ‘
最新推荐文章于 2024-02-20 14:11:32 发布