需要Babel“ ^ 7.0.0-0”,但已加载“ 6.26.3”

时间:2018-08-31 21:01:05

标签: node.js babeljs

我无法弄清楚为什么会引发以下错误。我遵循了babel的官方迁移指南,将我的babel依赖项全部都等同于7,所以我得到了这个错误:

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.
at throwVersionError (/code/node_modules/@babel/helper-plugin-utils/lib/index.js:65:11)
at Object.assertVersion (/code/node_modules/@babel/helper-plugin-utils/lib/index.js:13:11)
at _default (/code/node_modules/@babel/plugin-proposal-object-rest-spread/lib/index.js:41:7)
at /code/node_modules/@babel/helper-plugin-utils/lib/index.js:19:12
at Function.memoisePluginContainer (/code/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:113:13)
at Function.normalisePlugin (/code/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:146:32)
at /code/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:184:30
at Array.map (<anonymous>)
at Function.normalisePlugins (/code/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:158:20)
at OptionManager.mergeOptions (/code/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:234:36)
at OptionManager.init (/code/node_modules/babel-register/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
at compile (/code/node_modules/babel-register/lib/node.js:103:45)
at loader (/code/node_modules/babel-register/lib/node.js:144:14)
at Object.require.extensions.(anonymous function) [as .js] (/code/node_modules/babel-register/lib/node.js:154:7)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/code/src/backend/test/test.js:66:3)
at Module._compile (module.js:652:30)
at Module._compile (/code/node_modules/pirates/lib/index.js:83:24)
at Module._extensions..js (module.js:663:10)
at Object.newLoader (/code/node_modules/pirates/lib/index.js:88:7)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at /code/node_modules/mocha/lib/mocha.js:220:27
at Array.forEach (<anonymous>)
at Mocha.loadFiles (/code/node_modules/mocha/lib/mocha.js:217:14)
at Mocha.run (/code/node_modules/mocha/lib/mocha.js:469:10)
at Object.<anonymous> (/code/node_modules/mocha/bin/_mocha:404:18)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3

虽然该错误表明要查找非babel-core或@ babel / core条目,但其中有很多,我想最明显的是pirates程序包,它本身是{{1 }}?!?

我的依赖项:

babel-register

并通过... "@babel/cli": "^7.0.0", "@babel/core": "^7.0.0", "@babel/plugin-proposal-class-properties": "^7.0.0", "@babel/plugin-proposal-decorators": "^7.0.0", "@babel/plugin-proposal-do-expressions": "^7.0.0", "@babel/plugin-proposal-export-default-from": "^7.0.0", "@babel/plugin-proposal-export-namespace-from": "^7.0.0", "@babel/plugin-proposal-function-bind": "^7.0.0", "@babel/plugin-proposal-function-sent": "^7.0.0", "@babel/plugin-proposal-json-strings": "^7.0.0", "@babel/plugin-proposal-logical-assignment-operators": "^7.0.0", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0", "@babel/plugin-proposal-numeric-separator": "^7.0.0", "@babel/plugin-proposal-object-rest-spread": "^7.0.0", "@babel/plugin-proposal-optional-chaining": "^7.0.0", "@babel/plugin-proposal-pipeline-operator": "^7.0.0", "@babel/plugin-proposal-throw-expressions": "^7.0.0", "@babel/plugin-syntax-dynamic-import": "^7.0.0", "@babel/plugin-syntax-import-meta": "^7.0.0", "@babel/plugin-transform-destructuring": "^7.0.0", "@babel/plugin-transform-modules-commonjs": "^7.0.0", "@babel/register": "^7.0.0", "@babel/node": "^7.0.0", ... 开关运行摩卡咖啡。

0 个答案:

没有答案