首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法找到模块“babel-core”,但@babel/core已安装

无法找到模块“babel-core”,但@babel/core已安装
EN

Stack Overflow用户
提问于 2019-05-24 09:09:50
回答 1查看 7.7K关注 0票数 13

运行jest测试后,其中一个测试将得到此错误。

代码语言:javascript
复制
Cannot find module 'babel-core'

      at Object.<anonymous> (node_modules/vue-jest/lib/compilers/babel-compiler.js:1:15)

很简单。巴贝尔核心没有安装。但是新版本的babel (@babel/core)已经安装好了!

在这里我添加了我的package.json devDependencies

代码语言:javascript
复制
"devDependencies": {
    "@babel/core": "^7.4.5",
    "@babel/preset-env": "^7.4.5",
    "@babel/runtime": "^7.4.4",
    "@vue/cli-plugin-babel": "^3.7.0",
    "@vue/cli-plugin-eslint": "^3.7.0",
    "@vue/cli-plugin-pwa": "^3.7.0",
    "@vue/cli-service": "^3.7.0",
    "@vue/test-utils": "^1.0.0-beta.29",
    "axios-mock-adapter": "^1.16.0",
    "babel-eslint": "^10.0.1",
    "babel-loader": "^8.0.6",
    "babel-preset-env": "^1.7.0",
    "bootstrap": "^4.3.1",
    "eslint": "^5.8.0",
    "eslint-plugin-vue": "^5.0.0",
    "gulp-babel": "^8.0.0",
    "jest": "^24.8.0",
    "jest-serializer-vue": "^2.0.2",
    "jest-transform-stub": "^2.0.0",
    "jest-watch-typeahead": "^0.3.1",
    "json-loader": "^0.5.7",
    "less-loader": "^4.1.0",
    "postcss-flexbugs-fixes": "^4.1.0",
    "postcss-loader": "^3.0.0",
    "raw-loader": "^2.0.0",
    "sw-precache-webpack-plugin": "^0.11.5",
    "vue-jest": "^3.0.4",
    "vue-loader": "^15.7.0",
    "vue-template-compiler": "^2.5.21",
    "webpack": "^4.32.0",
    "webpack-cli": "^3.3.2"
  },

我想知道如何才能让我的babel装载机或玩笑识别@babel/core而不是babel-core。我读到babel-loader 8+应该做这项工作,但它并不像预期的那样工作。

我不知道这是个无聊的问题,但是谢谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-05-24 09:13:42

babel-core不是@babel/core --它们是不同的包。

你应该能在这里逃脱

票数 10
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56289348

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档