Problems with babel loader in react-create-app

后端 未结 11 1180
孤城傲影
孤城傲影 2021-02-18 16:50

The Problem

create-react-app initializes a repository where babel-loader is installed as an older version than needed.

LOG:

There          


        
相关标签:
11条回答
  • 2021-02-18 17:18

    However, a different version of babel-loader was detected higher up in the tree:

    You should delete babel-loader package that was was detected higher up the tree. The output says there is a node_modules folder with babel-loader at..

    C:\Users\user\node_modules\babel-loader (version: 8.0.2)

    You may be able to delete the C:\Users\user\node_modules directory altogether as well, unless for some reason you have a project rooted there inside /Users/{user}

    0 讨论(0)
  • 2021-02-18 17:22

    I had this exact same issue. For anyone who finds this thread via Google and is a beginner like me. Here is exactly what to enter into your terminal(Mac User).

    Say you're getting the same error that Paul was getting:

    "The react-scripts package provided by Create React App requires a dependency: "babel-loader": "8.0.6"

    Here's what I entered into the terminal. I could be wrong, but this is what worked for me (I am also a beginner):

    Step 1: Delete the node_modules folder as well as the package_lock.json files.

    Step 2: In your terminal, type cd - (we're just getting outside of our project folder and going into your home folder)

    Step 3: In your terminal type in npm i "dependency-name@number" so for the above example it would be: npm i babel-loader@8.0.6

    Step 4: Now in your terminal, navigate into your project folder and type: npm install or yarn install

    Step 5: Try running npm start and if all the issues have been solved, it should start the development server.

    Note: I had to do the above process twice, for babel-loader@8.0.6 as well as for Webpack.

    0 讨论(0)
  • 2021-02-18 17:25

    Create a .env file in your project directory and include SKIP_PREFLIGHT_CHECK=true in the file.

    0 讨论(0)
  • 2021-02-18 17:26
     C:\Users\user\node_modules\babel-loader
    

    Delete node_modules from \user\node_modules don't delete from your project

    if you are using backend (nodejs) check if you are using webpack in your backend make sure your create-react-app webpack and backend webpack version same

    0 讨论(0)
  • 2021-02-18 17:28

    You can momentarily downgrade react-scripts to 1.1.5 in the package.json file, then remove the node_modules folder and in the case of using NPM delete the package-lock.json file and in case Yarn delete the file yarn.lock. After that, reinstall the dependencies and start the development server with the yarn start or npm run start command.

    0 讨论(0)
  • 2021-02-18 17:29

    Getting the same issue but given an hour on it get the solution When we run npm start then you got this kind of an error that is version related issues for this issue. Go to node_modules folder:

    Project->node_modules->react-scripts->package.json
    

    check the package.json file

    there you got : "babel-loader": "8.0.4" first remove : babel-loader folder for Project->node_modules->babel-loader and then run npm i babel-loader@8.0.4 (it is depend on your version you can change it like : npm i babel-loader@8.0.5) after that may be you got webpack issue then follow same thing remvoe webpack from "Project->node_modules->webpack" and reinstall npm i webpack@4.19.1

    4.19.1* webpack's version it may be change..

    0 讨论(0)
提交回复
热议问题