1

When I write npx create-react-app-my-app in CMD windows I'm getting an error.

I have installed Node.js:

C:\Users\dev>node --version
v15.4.0

error:

node:internal/modules/cjs/loader:928
  throw err;
  ^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js'

at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15)

at Function.Module._load (node:internal/modules/cjs/loader:769:27)

at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)

at node:internal/main/run_main_module:17:47 {

  code: 'MODULE_NOT_FOUND',

  requireStack: []

}

node:internal/modules/cjs/loader:928

  throw err;

  ^



Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npx-cli.js'

[90m    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15)[39m

[90m    at Function.Module._load (node:internal/modules/cjs/loader:769:27)[39m

[90m    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)[39m

[90m    at node:internal/main/run_main_module:17:47[39m {

  code: [32m'MODULE_NOT_FOUND'[39m,

  requireStack: []

}
ronapelbaum
  • 1,617
  • 14
  • 19
  • 1
    Does this answer your question? [NPM: npm-cli.js not found when running npm](https://stackoverflow.com/questions/24721903/npm-npm-cli-js-not-found-when-running-npm) – Capt 171 Oct 10 '21 at 06:16

3 Answers3

2

What you need is npx create-react-app my-app. You can replace 'my-app' with what you want to name the application. Your command is currently missing the space.

  • Thanks for ur response Still, I m getting the same error tried all possibilities (reinstalled ) – sai krishna Dec 16 '20 at 07:14
  • Challenging to replicate on my end, but here are some steps to try if you haven't already. 1. Even if you reinstalled Node, check to see if you have an existing node_modules folder. If so, use this command. `rm -rf node_modules`. Then try to recreate the app. 2. If you have a package-lock.json file in that directory, make sure you delete that before reinstalling node_modules. Use this command to attempt both steps `rm -rf node_modules package-lock.json` – Daniel Volosov Dec 16 '20 at 15:42
0

please add the command below, I hope this solves your problem: node ./src/index.js

feychu
  • 1,284
  • 1
  • 14
  • 33
0

@Danila Volosov the author uses CMD and Windows as mentioned in OP, and rm -rf does not work on Windows.
NPM is looking for npm-cli.js under C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\, which is wrong and doesn't exist. This occurs when the path is set wrongly, so find the following in the PATH env:

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

and replace it with

C:\Program Files\nodejs

It'll probably work after this.

You can also take a look at the following:

Capt 171
  • 665
  • 5
  • 15