我在 CMD(Windows 11)中使用 npx create-react-app my-app 并且總是收到錯誤“缺少 package.json 中的依賴項”。當我嘗試 npm start 時,我得到“npm ERR!缺少腳本:“start””。
嘗試在不同的檔案夾中創建,卸載 NodeJS 并使用 Node 安裝程式和 NVM 再次安裝它。嘗試安裝紗線。還嘗試了--use-npm。
uj5u.com熱心網友回復:
終于讓它作業了。搜索我的用戶檔案夾,我在 C:\Users\User 中找到了這個檔案“.npmrc”,檔案中唯一的一行是“location=global”。我洗掉了檔案,現在 create-react-app 可以作業了!??
uj5u.com熱心網友回復:
運行這個命令
npm install
或者npm install --legacy-peer-deps
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/515810.html
