[英]executing create-react-app gives an error
I get the following error when I run create-react-app my-new-app. 运行create-react-app my-new-app时出现以下错误。 My npm version is 6.1.0 and node version is 8.11.3 我的npm版本是6.1.0,节点版本是8.11.3
$ create-react-app my-new-app
Creating a new React app in C:\Users\home\Desktop\Web Development\7.
React\my-new-app.
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 '...ectories":
{},"dist"
:{'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\home\AppData\Roaming\npm-cache\_logs\2018-06-
16T12_46_38_1
22Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-
scripts
has failed.
Deleting generated file... package.json
Deleting my-new-app / from C:\Users\home\Desktop\Web Development\7. React
Done.
尝试以下命令:
npm cache clean --force
Maybe you have an outdated create-react-app version. 也许您有过时的create-react-app版本。
If you have npm 6, then you also have npx . 如果您有npm 6,那么您也有npx 。 Using npx you can just do: 使用npx,您可以执行以下操作:
npx create-react-app my-new-app
And it will use the latest create-react-app, even if you don't have it installed. 即使您没有安装它,它也会使用最新的create-react-app。 Check the documentation 检查文件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.