【问题标题】:Error during launch of an Android emulator启动 Android 模拟器时出错
【发布时间】:2019-03-14 13:39:14
【问题描述】:

我不明白为什么我启动模拟器时会出现这个问题。

warning: the transform cache was reset.
Loading dependency graph, done.
error: bundling failed: Error: Unable to resolve module `react` from `/Users/myname/Sites/Project/App.js`: Module `react` does not exist in the Haste module map

This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:
  1. Clear watchman watches: `watchman watch-del-all`.
  2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
  3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.
  4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`.

我使用npm start -- --reset-cache 命令启动服务器,但它不起作用。而且我也尝试按照上述说明进行操作。 我该怎么办?

我不认为这是代码问题,我更新了我的 Android Studio 并安装了一个组件(反应原生元素),现在它不再工作了。 有什么帮助吗?

【问题讨论】:

  • 可能你正在寻找this
  • @BhavikParmar 我尝试了这些解决方案,但它们不起作用:/
  • 我使用gist 中的命令来清除缓存。请记住也要关闭您的捆绑程序。
  • @Andrew 我应该粘贴所有代码吗?
  • 不,您只需要根据您的要求选择一个。如果您使用的是 windows,那么可能是最后一个,mac 则可能是倒数第二个。

标签: android react-native npm


【解决方案1】:

我通过安装在应用程序文件夹中解决了:

npm install react 

【讨论】:

    【解决方案2】:

    在终端中,运行此命令,然后再试一次

    npm start -- --reset-cache
    

    如果有帮助请告诉我。

    【讨论】:

    • 我写过我试过这个,但没有任何改变。
    猜你喜欢
    • 1970-01-01
    • 2021-01-07
    • 1970-01-01
    • 2016-03-20
    • 2016-08-08
    • 2015-09-15
    相关资源
    最近更新 更多