Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/377.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 找不到模块';巴别塔核心&x27;但是安装了@babel/core_Javascript_Vue.js_Jestjs_Babeljs - Fatal编程技术网

Javascript 找不到模块';巴别塔核心&x27;但是安装了@babel/core

Javascript 找不到模块';巴别塔核心&x27;但是安装了@babel/core,javascript,vue.js,jestjs,babeljs,Javascript,Vue.js,Jestjs,Babeljs,运行jest测试后,其中一个测试出现此错误 Cannot find module 'babel-core' at Object.<anonymous> (node_modules/vue-jest/lib/compilers/babel-compiler.js:1:15) 我想知道如何让我的babel loader或jest识别@babel/core而不是babel core。我读到babel loader 8+应该做这项工作,但它没有按预期工作 我不知道这是一个vu

运行
jest
测试后,其中一个测试出现此错误

Cannot find module 'babel-core'

      at Object.<anonymous> (node_modules/vue-jest/lib/compilers/babel-compiler.js:1:15)
我想知道如何让我的babel loader或jest识别@babel/core而不是babel core。我读到babel loader 8+应该做这项工作,但它没有按预期工作


我不知道这是一个vue玩笑问题,但谢谢。

babel core
不是
@babel/core
——它们是不同的软件包

你应该可以在这里逃过一劫

  • 安装
  • 或者使用
    @babel/core

@babel/core和babel core是不同的我知道,它们是不同版本的babel core。这就是为什么我不明白。为什么要求巴别塔核心?而不是@babel/core?babel 7的可能复制品与babel 6不向下兼容。如果您想使用Babel 7,您需要将所有相关的依赖项升级到Babel 7(
@Babel/core
)。我在使用Babel core时遇到很多错误,我想我会尝试使用vue jest 4
"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"
  },