[英]I couldn't create react app by using the cmd “npx create-react-app”
[英]Can´t create react app using npx create-react-app
我是新手,但我已經創建了一些應用程序,但是今天當我嘗試創建一個新應用程序時,它不起作用。 我正在使用節點版本 v15.6.0 和 npm 7.4.0。 我的操作系統是 Windows 10。
我正在處理的文件樹: C: Users\kryst\Documents\test-app\app\package.JSON
但是當我在C: Users\kryst\Documents\test-app
目錄中運行 npx npx create-react-app app
時,它會拋出這些消息。
PS C:\Users\kryst\Documents\test-app> npx create-react-app app
You are running `create-react-app` 4.0.1, which is behind the latest release (4.0.2).
We no longer support global installation of Create React App.
Please remove any global installs with one of the following commands:
- npm uninstall -g create-react-app
- yarn global remove create-react-app
The latest instructions for creating a new app can be found here:
npm ERR! code 1
npm ERR! path C:\Users\kryst\Documents\test-app
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c create-react-app app
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\kryst\AppData\Local\npm-cache\_logs\2021-02-07T09_22_38_962Z-debug.log
我已經嘗試過npm cache clean --force
,重新安裝整個應用程序並重新啟動計算機。
你知道如何解決這個問題嗎? 我會很感激任何事情。
npm install -g create-react-app --force
解決方案已經在錯誤日志中:
1-您已經在您的機器上全局安裝了create-react-app
,因此使用以下命令之一刪除所有全局安裝:
npm uninstall -g create-react-app
yarn global remove create-react-app
2-如果你想創建一個應用程序,只需輸入:
npx create-react-app your_app_name
這將使 npx 從npx
注冊表中獲取create-react-app
並在本地運行它而不安裝它。
從npm 7.0.0開始, 重寫了npx二進制文件並
--ignore-existing 選項被刪除。 本地安裝的 bin 始終存在於執行的進程 PATH 中。
所以之前緩存的二進制文件總是首先被調用,現在我們必須明確 state 我們對 package 版本的意圖(只需將@latest添加到 ZEFE90A8E604A7C840E88D03A67F6B7D8 名稱):
npx create-react-app@latest app
或者,如果您想從緩存中刪除舊版本,只需清除_npx文件夾即可。 您可以使用npm get cache
命令找到它的位置。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.