when i install create -react-app i come upon an error this is the error code i got
first i try installing by running this command npx create-react-app my-app then i got 'create-react-app' is not recognized as an internal or external command, operable program or batch file.
Need to install the following packages:
create-react-app
Ok to proceed? (y) y
'create-react-app' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\Ela EKİZ\Desktop\create-react-app>npm start
> start
> cd packages/react-scripts && node bin/react-scripts.js start
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'react-dev-utils/crossSpawn'
Require stack:
- C:\Users\Ela EKİZ\Desktop\create-react-app\packages\react-scripts\bin\react-scripts.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (C:\Users\Ela EKİZ\Desktop\create-react-app\packages\react-scripts\bin\react-scripts.js:18:15)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\Ela EKİZ\\Desktop\\create-react-app\\packages\\react-scripts\\bin\\react-scripts.js'
]
}```
CodePudding user response:
Delete the whole folder including node_modules.
Run npm install again.
Good luck.
CodePudding user response:
As the information provided, i didn't get the idea like what's the exact problem . But you can try below methods :
npx create-react-app my-app
( IF you are using node version >=8Add
C:\Users\ugur\AppData\Roaming\npm
ORC:\Users\Admin\AppData\Roaming\npm\node_modules
to windows PATH variable.Use this
npx create-react-app new_app --use-npm
If you didn't understand the 2nd one solution or maybe path will be different they use below method :
=>Check your global directory by using command npm root -g
=>check the folder, will it have .cmd of your installed packages.
=>If yes, Please copy the path of folder and put in path of user variable