Requires Babel “7.0.0-0” but was loaded with “6.26.3”

前端 未结 10 848
深忆病人
深忆病人 2020-12-08 06:16

Keep getting this error no matter what I tried installing (babel wise) as I follow other similar reports. this is the stack trace:

error: bundli         


        
相关标签:
10条回答
  • 2020-12-08 07:16

    None of the solutions I found online worked, I fixed it the following way:

    1. Remove jest and @babel/core from package.json (keep babel-core v7 bridge)
    2. Remove node_modules and package-lock.json
    3. npm install
    4. npm install jest @babel/core --save-dev
    0 讨论(0)
  • 2020-12-08 07:18

    I accidentally had a file called .babelrc in my root directory with the following contents:

    {
      "presets": ["@babel/preset-env"]
    }
    

    After I deleted that file, I no longer got this error when running my gulp command.

    0 讨论(0)
  • 2020-12-08 07:19

    Sometimes, you have a local version, so remove it so that the global version is ran:

    npm uninstall babel-cli
    npm uninstall babel-core
    
    0 讨论(0)
  • 2020-12-08 07:20

    Test which version you are running with cmd

    babel -V
    

    If it is not verion 7 or higher

    npm uninstall babel-cli -g
    npm uninstall babel-core -g
    

    And

    npm install @babel/cli -g
    npm install @babel/core -g
    

    If you are using Jest run

    npm install babel-core@7.0.0-bridge.0 --save-dev
    

    Uninstall and reinstall @babel/node solves the problem if you do node development.

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