[英]npm ERR! Unexpected end of JSON input while parsing near '..."jscs":"~3.0.7","moch'
I have a problem with npm.我对 npm 有问题。 I tried:
npx create-react-app my-app
but it returned an error.我试过:
npx create-react-app my-app
但它返回了一个错误。
My command prompt output:我的命令提示符输出:
c:\Users\sysli\Desktop\reactprojects>npx create-react-app my-app
npx: installed 91 in 34.825s
Creating a new React app in c:\Users\sysli\Desktop\reactprojects\my-app.
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 '..."jscs":"~3.0.7","moch'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\sysli\AppData\Roaming\npm-cache\_logs\2019-12-26T21_21_02_198Z-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 my-app/ from c:\Users\sysli\Desktop\reactprojects
Done.
Log file: https://justpaste.it/3s5ym日志文件: https : //justpaste.it/3s5ym
Update npm on your machine ( Prasool advice ):在您的机器上更新 npm( Prasool 建议):
sudo npm i -g npm
If it does not work as expected, please use如果它没有按预期工作,请使用
npm cache clean --force
as it seems to work for some around here and GitHub.因为它似乎适用于这里和 GitHub 的一些人。 :)
:)
Have a happy coding time!有一个快乐的编码时间!
Can you retry after updating npm?更新 npm 后可以重试吗?
npm install -g npm npm install -g npm
Please note that this command will remove your current version of npm.请注意,此命令将删除您当前版本的 npm。 Make sure to use sudo npm install -g npm if on a Mac.
如果在 Mac 上,请确保使用 sudo npm install -g npm。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.