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

时间:2019-01-27 09:36:14

标签: javascript reactjs babel babel-loader

我似乎无法弄清楚这个错误。这与react 16.7.0更新或mdbreact有关吗?这些错误出现的同时,我更新了我的应用程序。我遵循了webpack和babel文档。我还向webpack.config文件中添加了一个模块对象,用于处理先前的错误消息。

我在纱线上添加了babel-jest babel-core@^7.0.0-0,但这带来了另一个错误。

ERROR in ./src/index.js
Module build failed (from ../node_modules/babel-loader/lib/index.js):
Error: Plugin/Preset files are not allowed to export objects, only functions. In C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\babel-preset-react\lib\index.js
    at createDescriptor (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\config\config-descriptors.js:178:11)
    at items.map (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\config\config-descriptors.js:109:50)
    at Array.map (<anonymous>)
    at createDescriptors (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\config\config-descriptors.js:109:29)
    at createPresetDescriptors (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\config\config-descriptors.js:101:10)
    at passPerPreset (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\config\config-descriptors.js:58:96)
    at cachedFunction (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\config\caching.js:33:19)
    at presets.presets (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\config\config-descriptors.js:29:84)
    at mergeChainOpts (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\config\config-chain.js:320:26)
    at C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\config\config-chain.js:283:7
    at buildRootChain (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\config\config-chain.js:68:29)
    at loadPrivatePartialConfig (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\config\partial.js:85:55)
    at loadFullConfig (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\config\full.js:43:39)
    at transformSync (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\transform.js:41:38)
    at Object.transform (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\transform.js:22:38)
    at transpile (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\babel-loader\lib\index.js:50:20)
    at C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\babel-loader\lib\fs-cache.js:118:18
    at ReadFileContext.callback (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\babel-loader\lib\fs-cache.js:31:21)
    at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:238:13)
 @ multi babel-polyfill ./src/index.js app[1]

ERROR in ../node_modules/babel-polyfill/lib/index.js
Module build failed (from ../node_modules/babel-loader/lib/index.js):
Error: Plugin/Preset files are not allowed to export objects, only functions. In C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\babel-preset-react\lib\index.js
    at createDescriptor (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\config\config-descriptors.js:178:11)
    at items.map (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\config\config-descriptors.js:109:50)
    at Array.map (<anonymous>)
    at createDescriptors (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\config\config-descriptors.js:109:29)
    at createPresetDescriptors (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\config\config-descriptors.js:101:10)
    at passPerPreset (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\config\config-descriptors.js:58:96)
    at cachedFunction (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\config\caching.js:33:19)
    at presets.presets (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\config\config-descriptors.js:29:84)
    at mergeChainOpts (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\config\config-chain.js:320:26)
    at C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\config\config-chain.js:283:7
    at buildRootChain (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\config\config-chain.js:68:29)
    at loadPrivatePartialConfig (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\config\partial.js:85:55)
    at loadFullConfig (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\config\full.js:43:39)
    at transformSync (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\transform.js:41:38)
    at Object.transform (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\@babel\core\lib\transform.js:22:38)
    at transpile (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\babel-loader\lib\index.js:50:20)
    at C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\babel-loader\lib\fs-cache.js:118:18
    at ReadFileContext.callback (C:\Users\Owner\Desktop\test\phr-india-ui\node_modules\babel-loader\lib\fs-cache.js:31:21)
    at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:238:13)
 @ multi babel-polyfill ./src/index.js app[0]


0 个答案:

没有答案