即使我嘗試了 React 官方檔案中提到的開始使用的所有內容,create-reate-app 也沒有初始化。我嘗試了以下命令:
npx create-react-app my-app
然后我收到了這個 ** 您運行的是create-react-app4.0.3,它落后于最新版本 (5.0.0)。
我們不再支持全域安裝 Create React App。
請使用以下命令之一洗掉任何全域安裝:
- npm uninstall -g create-react-app
- 紗線全域洗掉 create-react-app
可以在此處找到有關創建新應用程式的最新說明:https : //create-react-app.dev/docs/getting-started/ ** 然后我運行:
npm uninstall -g create-react-app
但是當我重復 npx create-react-app 時,我收到了我在上面用粗體粘貼的回復。我也試過
npm init react-app my-app
我已經將所有這些重復了 3 次以上,但現在沒有用,請告訴我是什么問題:(
uj5u.com熱心網友回復:
嘗試使用 create-react-app 創建新的 React 應用程式時出現此問題,但與安裝時的一些隨機 JSON 讀取問題有關,例如 .. >= 5.0 || 4.0 ..
但下面的修復解決了多個類似的問題。
首先,確保您已安裝所需或最新版本的節點。
npm install npm@latest -g
在使用 create-react-app 之前,請確保使用
npm cache clean --force
現在,應該可以創建新的 React 應用程式
npx create-react-app tl-app or npx create-react-app
如果要將當前目錄創建為專案根目錄。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/386251.html
