android - Haste 模块映射中不存在模块 `@babel/runtime/helpers/interopRequireDefault`

标签 android ios react-native npm-install

我开始学习对 native 使用react,当我成功运行我的项目构建时我得到了这个,但是当打开应用程序并得到这个错误时

我必须像 react-native init AwesomeProject 一样运行我的 React Native 示例项目

CD AwesomeProject

npm 安装

react-native run-android

and getting this errorerror: bundling failed: Error: Unable to resolve module @babel/runtime/helpers/interopRequireDefault from /Users/macbookpro/AwesomeProject/index.js: Module @babel/runtime/helpers/interopRequireDefault does not exist in the Haste module map`

在我从这个链接完成我所有的 react native 设置之前

https://facebook.github.io/react-native/docs/getting-started.html

我使用的是 macOS High Sierra 10.13.6

如有任何帮助,我将不胜感激!

最佳答案

这个问题可以通过使用来解决

npm add @babel/runtime
npm install

yarn add @babel/runtime

这个问题目前仍然悬而未决,希望在新版本中得到解决。 现在,您可以将 babel/runtime 保留在 devDependencies 中,但是如果您想使用此版本的 react-native 构建发布版本,则需要将 @babel/runtime 放在 dependencies 中。

这是 link了解更多详情

关于android - Haste 模块映射中不存在模块 `@babel/runtime/helpers/interopRequireDefault`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52686952/

相关文章:

android - 是否可以从任何地方通过语音命令触发您的应用程序?

ios - 如何在 Swift 中的注释 View 上显示不同的图标?

reactjs - React Native - 将选项allowNamespaces传递给babel typescript 插件

android - 使用 GoogleAnalytics 忽略多个安装 Activity 时出错

Android谷歌地图V2 : Binary XML file line #1: Error inflating class fragment

ios - 即使在暂停时也能获取 iOS 应用程序的位置更新

ios - iOS 中从 bundle 复制到缓存文件夹的文件具有编译的 CreationDate 和 ModifiedDate

react-native - 渲染网络 SVG 图像导致 android React-Native 上的性能问题(我想避免使用 React-Native-svg-uri)

android - React native 热重载刷新但不更新更改

android - Gradle 任务不在 Android Studio 中执行