'my react scripts isn't working - how can I fix it - error : module-not-found

I use a library - and write npm ci,run npm run docs:dev to build in my power shell in react project folder.

then I can't use react scrpits so use these code npm install , npm install react-scripts --save from stack overflow

then when I write npm start this is finall problem

  code: 'MODULE_NOT_FOUND',
  requireStack: [
     'B:\\project_react\\currency\\node_modules\\react-scripts\\bin\\react-scripts.js'
  ]

this is my hole package.json

{
"name": "currency",
"version": "0.1.0",
"private": true,
"dependencies": {
  "@testing-library/jest-dom": "^5.16.2",
  "@testing-library/react": "^12.1.3",
  "@testing-library/user-event": "^13.5.0",
  "chart.js": "^3.7.1",
  "react": "^17.0.2",
  "react-dom": "^17.0.2",
  "react-icons": "^4.3.1",
  "react-router-dom": "^6.3.0",
  "react-scripts": "^2.1.3",
  "victory": "^36.3.1",
  "web-vitals": "^2.1.4"
},
"scripts": {
  "start": "react-scripts start",
  "build": "react-scripts build",
  "test": "react-scripts test",
  "eject": "react-scripts eject"
},

"devDependencies": {
  "@babel/core": "^7.17.8",
  "@babel/preset-env": "^7.16.11",
  "@babel/preset-react": "^7.16.7",
  "babel-loader": "^8.2.4",
  "html-webpack-plugin": "^5.5.0",
  "webpack": "^5.71.0",
  "webpack-cli": "^4.9.2",
  "webpack-dev-server": "^4.7.4"
}

}



Solution 1:[1]

at first you should write npm audit fix --force

then powershell response some suggestion for you do that to fix this problem

power shell response

To fix the dependency tree, try following the steps below in the exact order:

1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
2. Delete node_modules in your project folder.
3. Remove "babel-loader" from dependencies and/or devDependencies in the package.json file in your project folder.
4. Run npm install or yarn, depending on the package manager you use.

In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:

5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above 

steps with it instead. This may help because npm has known issues with package hoisting which may get resolved in future versions.

6. Check if B:\project_react\currency\node_modules\babel-loader is outside your project directory.
 For example, you might have accidentally installed something in your home folder.

7. Try running npm ls babel-loader in your project folder.
 This will tell you which other package (apart from the expected react-scripts) 

installed babel-loader.

If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project. That would permanently disable this preflight check in case you want to proceed anyway.

P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 mohsen Ghalandar