react-native - 错误:捆绑失败:错误:无法解析模块`react-native
问题描述
我更新了所有依赖项以在 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 上编写代码。零食引发类型错误:未定义不是函数。附近)使用效果...
我猜博览会小吃平台使用过时的 React 和 React Native。
现在,我能做什么?如何运行开发服务器并继续使用二维码和我的手机调试?
解决方案
Expo 中仍然不支持 Hooks。有一个关于此的功能请求,但仍在进行中:https ://expo.canny.io/feature-requests/p/support-react-1680-aka-hooks
推荐阅读
- xaml - 让图像与 GRID 中的文本显示在同一行
- java - IntelliJ 不会重新编译/构建 Maven 项目
- git - Netlify 中检测到不安全的混合内容
- regex - 正则表达式 - 检查至少重复两次的字母
- azure - Runbook 结果中显示的额外 azure 帐户信息 azure 自动化
- spring-integration - Spring集成多个轮询器
- git - 自上次合并以来的 Git 修订范围,包括该合并
- javascript - 更新未包含在 act(...) 中,并且模拟函数未触发。反应测试库,开玩笑
- haskell - Haskell:“约束中的非类型变量参数:Eq Bit”和“没有使用 '==' 产生 (Eq Bit) 的实例”
- javascript - 是否可以将此列作为数组进行迭代(并且效率更高)?