![](/img/trans.png)
[英]Error: Unable to resolve module `@react-native-community/toolbar-android`
[英]Unable to resolve "@react-native-community/masked-view
我正在使用 react native expo 版本 37.0.3 并且每次运行应用程序时都会收到此错误
Unable to resolve "@react-native-community/masked-view" from "node_modules\@react-navigation\stack\src\views\MaskedView.native.tsx"
Building JavaScript bundle: error`
我不知道为什么会出现这个错误
你没有按照 React Navigation 的安装说明进行操作。
由于您使用的是 Expo,因此您应该运行
expo install react-native-gesture-handler react-native-reanimated react-native-screens react-native-safe-area-context @react-native-community/masked-view
,根据入门文档。
@react-native-community/masked-view 是您需要安装的依赖项才能使用导航堆栈。
尝试做:
expo install @react-native-community/masked-view
对于反应本机 CLI 用户,请尝试以下操作
npx react-native start --reset-cache
node_modules
, package-lock.json
/ yarn.lock
并重新安装包有时本地缓存和节点模块在安装新库时仍然会导致错误。 然后您可以在项目文件夹中依次执行以下命令:
rm -rf node_modules
npm cache clear --force
npm i
expo install @react-native-community/masked-view
注意:也强制停止 expo 应用程序可能会更好
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.