簡體   English   中英

無法使用 create-react-app,因為它顯示以下錯誤

[英]Cannot use create-react-app as it shows below error

PS D:\Reactjs> npx create-react-app textutils

在 D:\Reactjs\textutils 中創建一個新的 React 應用程序。

安裝軟件包。 這可能需要幾分鍾。 使用 cra-template 安裝 react、react-dom 和 react-scripts...

npm 錯誤! 代碼 FETCH_ERROR npm 錯誤! 錯誤號 FETCH_ERROR npm 錯誤! invalid json response body at https://registry.npmjs.org/@typescript-eslint%2fscope-manager reason: Invalid response body while trying to fetch https://registry.npmjs.org/@typescript-eslint%2fscope-manager : 讀取 ECONNRESET

npm ERR:此運行的完整日志可在以下位置找到:npm ERR。 C:\Users\Ashes10\AppData\Local\npm-cache_logs\2022-08-22T05_43_38_991Z-debug-0.log

中止安裝。 npm install --no-audit --save --save-exact --loglevel 錯誤 react-dom react-scripts cra-template 失敗。

正在刪除生成的文件... package.json 從 D:\Reactjs 中刪除 textutils/ 完成。

也許這會奏效

npm cache clean --force

可能是因為緩存問題。 要解決此問題,請嘗試以下命令,

npm cache clean --force

如果問題仍然存在。 運行以下命令安裝create-react-app

npm install -g create-react-app

然后,嘗試創建你的反應應用程序,

npx create-react-app appname

我在遇到此錯誤的 vs 代碼終端中使用此命令。 后來我在 cmd 中嘗試了它,它成功了。

然后嘗試以管理員身份運行命令行

  • cd <your desired location to create the project>
  • npx create-react-app <project name>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM