0

I recently started coding again and I've got some issues regarding React/NodeJS (don't know which one is responsible for that)

So first things first, I installed VSCode, all clean, no errors no nothing. Then I installed NodeJS. Now I'm just trying to create a React project for my own. I didn't install React at all as it seems it came by default after installing NodeJS. Now comes the ugly stuff. Whenever I use the "npx create-react-app something-name" I get the following:

$ npx create-react-app demo
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.

I also get some audit errors/vulnerabilities but maybe they are not so important as they get fixed after I use "audit fix --force".

So let's say that we just want to start the project. I use cd something-name and npm start and I get this:

$ npm start

> demo@0.1.0 start
> react-scripts start

The system cannot find the path specified.
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'D:\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:77:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

If anybody could help me remove those warnings from NPM and also let me know what should I do in order to start my project would be highly appreciated!

  • 1
    Be careful about the `npm audit fix --force`, it might install other major versions of packages. This can be the issue. – JSON Derulo Jun 10 '22 at 07:19
  • what version of node do you have installed? – DJ Burb Jun 10 '22 at 07:21
  • I tried `npx create-react-app demo` and did not see any error. This command should install all the react dependency for you. Maybe you just try again and paste the result log here? Also what is your nodeJS version? You can get it with `node --version`. – Jim LK Yu Jun 10 '22 at 07:22
  • If you update npm to `8.12.1` the first warning will go away. https://stackoverflow.com/a/72477810/1354378 – Idrizi.A Jun 10 '22 at 07:27
  • @Enve I tried this and it doesn't work – Panait Ionut Alexandru Jun 10 '22 at 07:37
  • It seems some people are still having issues with it, see [https://github.com/npm/cli/issues/4980](https://github.com/npm/cli/issues/4980). I was getting the warning myself just now and it went away when I upgraded using `npm install -g npm@latest`. – Idrizi.A Jun 10 '22 at 08:33

2 Answers2

0

Hello there sir here are some possible fixes according to a previous question Error: Cannot find module '\react-scripts\bin\react-scripts.js'

  1. Check your package.json file in your project folder

  2. delete node_modules, and package.lock.json reinstall them by

npm install 
  1. Check if your project path has a special character which is "&" just remove it

  2. Try running a production build

//makes the production build
npm build 
// runs the production build
npm run build
  1. Finally try reinstalling node js on your system that could be the issue aswell

https://nodejs.org/en/

Omar Zeinhom
  • 125
  • 7
  • It doesn't work. Tried reinstalling VSCode, NPM and even Git (I thought it might have some dependencies that are stuck somewhere). Nothing works – Panait Ionut Alexandru Jun 14 '22 at 06:17
  • Sorry to hear that mate , do you have a previous version on github for example an old commit that did not have the error before? – Omar Zeinhom Jun 23 '22 at 15:09
0

check your node version and make sure is updated.

  1. remove the node-modules ()
  2. npm install
  3. npm start
Nafis
  • 99
  • 1
  • 5