簡體   English   中英

NPX-CRA:創建反應應用程序,使用 npx 會引發錯誤

[英]NPX-CRA: creating react app, using npx throws an error

我正在嘗試使用 npx 命令創建一個 React 應用程序,如下所示

npx create-react-app my-app

但這給了我一個錯誤說

'CALL "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\\node_modules\npm\bin\npm-cli.js" prefix -g' is not recognized as an internal or external command,
operable program or batch file.
spawn C:\Windows\system32\cmd.exe;C:\xampp\php ENOENT

我在谷歌上搜索了錯誤並偶然發現了一些建議將 npm 路徑添加到系統變量或將系統 32 路徑添加到系統變量的答案。

我的用戶變量

C:\Program Files\nodejs\
C:\Program Files\nodejs\node_modules\npm

我的系統變量

%SystemRoot%\system32\cmd.exe
C:\Program Files\nodejs

我對 node js 不太熟悉,並且難以理解互聯網上可用的答案。

任何人都可以用適當的答案解釋這種情況嗎?

嘗試以下命令來啟動並運行 npx:

- npm cache clean --force
- npm init
- npm install create-react-app
- npx create-react-app myapp

暫無
暫無

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

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