简体   繁体   English

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

[英]Cannot find module 'babel-core' but @babel/core is installed

After running jest tests, one of them is getting this error. 运行jest测试后,其中之一正在收到此错误。

Cannot find module 'babel-core'

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

It's pretty straightforward. 这很简单。 babel-core is not installed. 未安装babel-core。 But a newer version of babel-core (@babel/core) is installed! 但是会安装更新版本的babel-core(@ babel / core)!

Here I add my package.json devDependencies 在这里我添加了我的package.json devDependencies

"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"
  },

I want to know how can I get my babel loader or jest to recognize @babel/core and not babel-core. 我想知道如何使我的babel加载程序或笑话识别@ babel / core而不是babel-core。 I read that babel-loader 8+ should do the work, but its not working as expected. 我读到babel-loader 8+应该可以完成工作,但是它没有按预期工作。

Didn't know it was a vue-jest problem, but thanks. 不知道这是一个开玩笑的问题,但是谢谢。

babel-core is not @babel/core – they are different packages. babel-core不是@babel/core它们是不同的软件包。

You should be able to get away here with 您应该可以通过这里逃脱

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 ERROR in找不到模块'babel-core'。使用react.js,webpack和express服务器 - ERROR in Cannot find module 'babel-core'. using react.js, webpack, and express server 为什么需要@ babel-core - Why need @babel-core 模块构建失败(来自./node_modules/babel-loader/lib/index.js):错误:找不到模块'babel-core' - Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: Cannot find module 'babel-core' 'babel-core / register'vs'babel-register' - 'babel-core/register' vs 'babel-register' 模块构建失败:错误:找不到模块'@ babel / core' - Module build failed: Error: Cannot find module '@babel/core' Babel无法找到模块核心/启动Node.js - Babel cannot find module core/splash Node.js 如何将 babel 和 webpack 实现更新和整合到当前的最佳实践中? (错误:找不到模块“@babel/core”) - How to update and consolidate babel and webpack implementations to current best practices? (Error: Cannot find module '@babel/core') 找不到模块“@babel/generator”,但它已安装 - cannot find module '@babel/generator' but it installed 如何从babel-core中取出转译的字符串? - How do I get the transpiled string out of babel-core? 在 package.json 文件中包含“@babel/core”和“babel-core”有什么区别? - What's the difference between having "@babel/core" and "babel-core" in your package.json file?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM