Search code examples
node.jsreactjsnpmnode-modulesnpx

I am getting this error while creating react files


Getting this error while creating react file ? C:\Users\tusha\Desktop\New folder (4)>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. node:internal/modules/cjs/loader:1078 throw err; ^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\npx-cli.js' at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15) at Module._load (node:internal/modules/cjs/loader:920:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:23:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }

Node.js v18.15.0

I have tried to re-install nodejs and delete the module by creating the module file again ?


Solution

  • Your npm installation doesn't appear to be in your PATH.

    Open a command prompt (windows key + R, then cmd.exe)

    Update your PATH to include npm.

    setx PATH "%PATH%;C:\Program Files\nodejs\npm"
    

    Close the terminal command prompt.

    If your npm binary is in a different location, you can find it via the command prompt using

    where npm