安装版本冲突

新版本存在不兼容,在运行 React-native run-Android 运行报错,
babel-preset-react-native最新3.0.0版本有问题,造成的冲突,RN后期官方应该会修改。
先上图吧,大神请忽略我的解决方案。。。。
TransformError Unexpected token node_modules\babel-preset-react-native.........

解决方案

第一种解决方案,直接删除.babelrc(临时方案),不建议使用。
因为用 antd 的时候需要用这个文件做配置。

第二种方案:
——方案1:使用 yarn 工具
yarnremovebabelpresetreactnative yarn add [email protected]

方案2:使用 npm 工具
npmuninstallsavedevbabelpresetreactnative npm install [email protected]

方案3:
直接将package.json中的”babel-preset-react-native版本号修改为2.1.0,不使用最新版本。

参考

国外大胡子的解决方案:

https://github.com/facebook/react-native/issues/15513

安装最新版本时,要进行测试。以上问题只针对于遇到的朋友,仅供参考。。。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-25
  • 2022-01-11
  • 2018-06-05
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-31
  • 2021-07-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-06
相关资源
相似解决方案