简体   繁体   中英

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

I am trying to create a react app using npx command as follows

npx create-react-app my-app

but this gives me an error saying

'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

I googled the error and stumbled upon some answers which suggesting to add npm path to system variables or adding system 32 path to system variables.

My User Variables

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

My System Variables

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

I am not familiar with node js much and facing difficulty understanding the answer available on the internet.

Can anybody explain the situation with appropriate answer?

Try out following commands to get the npx up and running:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM