启动Android模拟器时出错

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

我不明白为什么在启动模拟器时遇到此问题。

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并安装一个组件(反应原生元素),现在它不再工作了。一些帮助?

android react-native npm
2个回答
0
投票

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

npm install react 

-1
投票

在终端中,运行此命令,然后重试

npm start -- --reset-cache

让我知道它是否有用。

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