[英]npm ERR! Unexpected end of JSON input while parsing near '..."jscs":"~3.0.7","moch'
我對 npm 有問題。 我試過: npx create-react-app my-app
但它返回了一個錯誤。
我的命令提示符輸出:
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.
日志文件: https : //justpaste.it/3s5ym
在您的機器上更新 npm( Prasool 建議):
sudo npm i -g npm
如果它沒有按預期工作,請使用
npm cache clean --force
因為它似乎適用於這里和 GitHub 的一些人。 :)
有一個快樂的編碼時間!
更新 npm 后可以重試嗎?
npm install -g npm
請注意,此命令將刪除您當前版本的 npm。 如果在 Mac 上,請確保使用 sudo npm install -g npm。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.