facebook / create-react-app

Set up a modern web app by running one command.
https://create-react-app.dev
MIT License
102.5k stars 26.77k forks source link

Module Not Found : Cannot load 'react-scripts start' command. #12620

Open ushnishdeybhowmik opened 2 years ago

ushnishdeybhowmik commented 2 years ago

Describe the bug

After doing a clean installation of React using npx create-react-app my-app in my-app folder, the npm start command failed to initialize the development server and produced MODULE NOT FOUND error

'D\my-app\node_modules\.bin\' is not recognized as an internal or external command,
operable program or batch file.
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'D:\Neil\Web Projects\Frontend\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 Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Environment

Environment Info:

  current version of create-react-app: 5.0.1
  running from C:\Users\neilb\AppData\Local\npm-cache\_npx\c67e74de0542c87c\node_modules\create-react-app

  System:
    OS: Windows 10 10.0.22000
    CPU: (8) x64 AMD Ryzen 5 3550H with Radeon Vega Mobile Gfx
  Binaries:
    Node: 16.13.2 - C:\Program Files\nodejs\node.EXE
    Yarn: Not Found
    npm: 8.13.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: Not Found
    Edge: Spartan (44.22000.120.0), Chromium (103.0.1264.49)
    Internet Explorer: 11.0.22000.120
  npmPackages:
    react: ^18.2.0 => 18.2.0
    react-dom: ^18.2.0 => 18.2.0
    react-scripts: 5.0.1 => 5.0.1
  npmGlobalPackages:
    create-react-app: Not Found

Cannot seem to fix the issue please help!

dev-phantom commented 2 years ago

cd into the folder you want to create my-app then run this in your terminal npx create-react-app my-app cd my-app npm run start

this should work

Kenramiscal1106 commented 2 years ago

Just use the vite and run:

npm init vite Then, select the react template

Allan2000-Git commented 11 months ago

Go to package.json file and under dependencies: re-write start as "start" : "node node_modules/react-scripts/bin/react-scripts start"

Then go to your terminal & run the command: npm run start