错误:捆绑失败:错误:无法解析模块“ react-native

时间:2019-04-24 12:53:06

标签: react-native expo

我更新了我所有的依赖,以在React Native中使用钩子。他们是:

"axios": "^0.18.0",
"expo": "^32.0.0",
"react": "^16.8.6",
"react-native": "^0.59.5",
"react-navigation": "^3.9.0"

在更新依赖项之前,开发服务器运行良好,但是在更新到最新版本后,它会显示错误:

error: bundling failed: Error: Unable to resolve module `react-native/Libraries/Components/View/ViewStylePropTypes` from `C:\Koolpeace\apps\node_modules\react-native-reanimated\src\createAnimatedComponent.js`: Module `react-native/Libraries/Components/View/ViewStylePropTypes` does not exist in the Haste module map
INFO
21:13
This might be related to https://github.com/facebook/react-native/issues/4968
INFO
21:13
To resolve try the following:
INFO
21:13
  1. Clear watchman watches: `watchman watch-del-all`.
INFO
21:13
  2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
INFO
21:13
  3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.
INFO
21:13
  4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`.

我尝试了互联网上的所有内容。我清空了缓存。我清空了所有缓存,包括

react-native start --reset-cache

他们都没有为我工作。我删除了node_modules并重新安装了几次。是一样的我只写了简单的东西,问题一定是依赖项内崩溃了。但是我不知道哪里出了问题。我也尝试降级。直到

"react": "^16.8",
"react-native": "^0.59"

支持挂钩的最低版本。它也不起作用。

我尝试在Expo Snack上编码。小吃引发类型错误:undefined不是函数。附近)useEffect ...

我猜这个博览会小吃平台使用了过时的React和React Native。

现在,我该怎么办?如何运行开发服务器并继续使用QR码和手机进行调试?

1 个答案:

答案 0 :(得分:0)

Expo仍不支持挂钩。有一个与此相关的功能请求,但仍在进行中:https://expo.canny.io/feature-requests/p/support-react-1680-aka-hooks