簡體   English   中英

npx create-react-app projectName 無法創建項目

[英]npx create-react-app projectName fails to create project

我正在使用 npx create-react-app 實驗創建一個反應項目,我收到以下錯誤,任何人都可以幫助解決它。 注意,我已經卸載了 create-react-app 的全局安裝

(base) sibulele@sibulele-X555LAB:~$ npx create-react-app 實驗

在 /home/sibulele/experiment 中創建一個新的 React 應用程序。

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

yarn add v1.22.18 info 找不到鎖文件。 [1/4] 解決包...

警告 react-scripts > @svgr/webpack > @svgr/plugin-svgo > svgo@1.3.2:不再支持此 SVGO 版本。 升級到 v2.xx

[2/4] 獲取包... [3/4] 鏈接依賴項... 警告“react-scripts > eslint-config-react-app > eslint-plugin-flowtype@8.0.3”具有未滿足的對等依賴項“@ babel/plugin-syntax-flow@^7.14.5"。

警告“react-scripts > eslint-config-react-app > eslint-plugin-flowtype@8.0.3”具有未滿足的對等依賴關系“@babel/plugin-transform-react-jsx@^7.14.9”。

警告“react-scripts > react-dev-utils > fork-ts-checker-webpack-plugin@6.5.2”具有未滿足的對等依賴項“typescript@>= 2.7”。

警告“react-scripts > eslint-config-react-app > @typescript-eslint/eslint-plugin > tsutils@3.21.0”具有未滿足的對等依賴性“typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7 .0-dev || >= 3.7.0-beta”。

[4/4] 構建新包...成功已保存鎖定文件。 成功保存了 745 個新依賴項。 info 直接依賴...

在 377.81 秒內完成。

沒有提供模板。 這可能是因為您使用的是過時版本的 create-react-app。 請注意,不再支持 create-react-app 的全局安裝。

您可以通過運行 npm uninstall -g create-react-app 或 yarn global remove create-react-app 來解決此問題,然后再次使用 create-react-app。 (base) sibulele@sibulele-X555LAB:~$ npm 審計發現 0 個漏洞

(基礎)sibulele@sibulele-X555LAB:~$

如果您之前通過npm install -g create-react-app create-react-app全局安裝了 create-react-app,我們建議您使用npm uninstall -g create-react-app卸載該軟件包,以確保 npx 始終使用最新版本。

使用以下任一命令:

  • npx create-react-app my-app

  • npm init react-app my-app

  • yarn create react-app my-app

如果上述npm uninstall -g create-react-app不起作用。 鍵入where create-react-app以了解它的安裝位置。 rm -rf /usr/local/bin/create-react-app手動刪除

謝謝大家。 @Kayzer161 在這篇文章中回答了我的問題。不再支持此 SVGO 版本。 升級到 v2.xx

這是答案:-

通過這個命令創建一個反應應用程序,npx create-react-app@latest my-app --use-npm

我有一個折舊版本的“tar”,我通過以下命令對其進行了更新:-

須藤 npm 我焦油

暫無
暫無

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

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