需要Babel“^ 7.0.0-0”,但加载了“6.26.3” - @ babel / preset-env

问题描述 投票:1回答:2

我安装@ babel / preset-env并尝试运行node.js文件时出现以下错误。

Requires Babel "^7.0.0-0", but was loaded with "6.26.3"

以下是堆栈跟踪

(While processing preset: "P:\\Projects\\ReactNative\\apc-c\\node_modules\\@babel\\preset-env\\lib\\index.js")
    at throwVersionError (P:\Projects\ReactNative\apc-c\node_modules\@babel\helper-plugin-utils\lib\index.js:65:11)
    at Object.assertVersion (P:\Projects\ReactNative\apc-c\node_modules\@babel\helper-plugin-utils\lib\index.js:13:11)
    at _default (P:\Projects\ReactNative\apc-c\node_modules\@babel\preset-env\lib\index.js:154:7)
    at P:\Projects\ReactNative\apc-c\node_modules\@babel\helper-plugin-utils\lib\index.js:19:12
    at P:\Projects\node_modules\babel-core\lib\transformation\file\options\option-manager.js:317:46
    at Array.map (<anonymous>)

我已经尝试了一些安装“7.0.0-bridge.0”等等。

有人可以请帮助。花了好几个小时试图解决这个问题。谢谢

babel babel-preset-env
2个回答
1
投票

发现了问题。我有一个.babelrc文件,其中包含对@ babel / preset-env和transform-react-jsx的引用。删除它们和编译的js文件就好了。


0
投票

我想我可以帮忙。面对同样的问题(虽然不是React-native只是React)而现在只需修复它,我能看到你的包json是什么样的吗?也许你可以用它来更新你的问题。什么脚本命令产生此错误?

© www.soinside.com 2019 - 2024. All rights reserved.