vscode调试报错

vscode调试报错

Error: Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If you are sure you have a compatible version of @babel/core, it is likely that something in your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core" or "babel-core" to see what is calling Babel. (While processing preset: "E:\\testWork\\慕课\\大前端\\阶段1\\demo1\\node_modules\\_@babel_preset-env@7.18.6@@babel\\preset-env\\lib\\index.js")

正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
Brian 2022-07-15 20:21:20

 Requires Babel "^7.0.0-0", but was loaded with "6.26.3". 


——这里有提示,应该是babel的版本兼容性问题,


能把你的配置文件,或者代码发上来看看吗?

  • 提问者 AA潮 #1

    {

      "name": "demo",

      "version": "1.0.0",

      "description": "",

      "main": "index.js",

      "scripts": {

        "start": "nodemon --exec babel-node src/index.js",

        "webpack:debug": "npx node --inspect-brk ./node_modules/webpack/bin/webpack --progress",

        "build": "cross-env NODE_ENV=prod webpack --config config/webpack.config.prod.js",

        "dev": "cross-env NODE_ENV=development webpack --watch --config ./config/webpack.config.dev.js",

        "clean": "rimraf dist"

      },

      "keywords": [],

      "author": "",

      "license": "ISC",

      "dependencies": {

        "@koa/cors": "^3.3.0",

        "koa": "^2.13.4",

        "koa-body": "^5.0.0",

        "koa-combine-routers": "^4.0.2",

        "koa-compose": "^4.1.0",

        "koa-compress": "^5.1.0",

        "koa-helmet": "^6.1.0",

        "koa-json": "^2.0.2",

        "koa-router": "^11.0.1",

        "koa-static": "^5.0.0",

        "svg-captcha": "^1.4.0"

      },

      "devDependencies": {

        "@babel/cli": "^7.18.6",

        "@babel/core": "^7.18.6",

        "@babel/node": "^7.18.6",

        "@babel/preset-env": "^7.18.6",

        "babel-core": "^7.0.0-bridge.0",

        "babel-jest": "^28.1.2",

        "babel-loader": "^8.2.5",

        "clean-webpack-plugin": "^4.0.0",

        "cross-env": "^7.0.3",

        "jest": "^28.1.2",

        "nodemon": "^2.0.19",

        "nodemon-webpack-plugin": "^4.8.1",

        "rimraf": "^3.0.2",

        "terser-webpack-plugin": "^5.3.3",

        "webpack": "^5.73.0",

        "webpack-cli": "^4.10.0",

        "webpack-merge": "^5.8.0",

        "webpack-node-externals": "^3.0.0"

      }

    }



    2022-07-18 21:37:03
  • 提问者 AA潮 #2

    {

      // 使用 IntelliSense 了解相关属性。

      // 悬停以查看现有属性的描述。

      // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387

      "version": "0.2.0",

      "configurations": [

        {

          "console": "integratedTerminal",

          "internalConsoleOptions": "neverOpen",

          "name": "nodemon",

          "program": "${workspaceFolder}/src/index.js",

          "request": "launch",

          "restart": true,

          "runtimeExecutable": "${workspaceFolder}/node_modules/.bin/nodemon",

          "skipFiles": [

            "<node_internals>/**"

          ],

          "type": "node",

          "runtimeArgs": ["--exec", "babel-node"]

        }

      ]

    }


    2022-07-18 21:37:46
  • Brian 回复 提问者 AA潮 #3

    "runtimeArgs": ["--exec""babel-node"] 这块的问题


    看看你的node_modules中的babel-node的版本,还是全局babel-node,去看看版本。


    2022-07-26 00:18:08
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
意见反馈 帮助中心 APP下载
官方微信

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师