0

I am currently learning how to use React, and I'm having problems running my React app using npm start. Specifically, I get an error which says - "Create React App requires a dependency: "babel-loader": "8.1.0"". The instructions given in the error message on how to fix this are as follows:

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.

I tried doing this, but when I ran npm install, I got the following:

added 1880 packages, and audited 1881 packages in 19s

153 packages are looking for funding
  run `npm fund` for details

58 vulnerabilities (16 moderate, 40 high, 2 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues (including breaking changes), run:
  npm audit fix --force

Then, when I ran npm start again, I got the same error.

I realize there is another thread on this here already: Create React App requires a dependency: "babel-loader": "8.1.0". But none of the suggestions on the thread have worked. For example, I tried creating a .env file with SKIP_PREFLIGHT_CHECK=true, but what I got was: enter image description here.

So I'm wondering what I can do to solve the problem. I would really appreciate it if someone could figure it out. This is my package.json file, if it helps:

{
  "name": "task-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.14.1",
    "@testing-library/react": "^11.2.7",
    "@testing-library/user-event": "^12.8.3",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-scripts": "4.0.3",
    "web-vitals": "^1.1.2"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}
Drew Reese
  • 165,259
  • 14
  • 153
  • 181
coder12341
  • 174
  • 1
  • 8
  • This kind of sounds like a bug with `create-react-app`. If you haven't added anything to the project yet, can you try to create a brand new react app and see if the `npm start` script works? – PsiKai Oct 24 '21 at 00:39
  • @PsiKai I've create multiple react apps, and all of them have the same problem. – coder12341 Oct 24 '21 at 00:45
  • How are you running `create-react-app`? Are you following the [documentation](https://reactjs.org/docs/create-a-new-react-app.html#create-react-app) and running `npx create-react-app `? – Drew Reese Oct 24 '21 at 02:45
  • 1
    That sucks, @EthanChan . Only other thing I can think of besides what @DrewReese said is to make sure you are running the correct versions of `node` and `npm`. But that is just a guess. – PsiKai Oct 24 '21 at 03:01
  • Does this answer your question? [Npm audit fix --force react script downgrade automatically](https://stackoverflow.com/questions/67693423/npm-audit-fix-force-react-script-downgrade-automatically) – Andrey Nov 11 '21 at 10:23

0 Answers0