我的世博會應用程式完美運行了很長時間。然后我安裝了 React-Navigation,現在我收到錯誤,說我缺少我不需要的模塊,比如 react-native-gesture-handler。我安裝了它,現在它需要 react-native-screens。我不能繼續安裝我不需要的東西。那么我的問題是什么?
錯誤資訊:
Failed building JavaScript bundle.
Unable to resolve module react-native-screens from C:\Users\***\test\node_modules\@react-navigation\stack\src\views\Screens.tsx: react-native-screens could not be found within the project.
If you are sure the module exists, try these steps:
1. Clear watchman watches: watchman watch-del-all
2. Delete node_modules and run yarn install
3. Reset Metro's cache: yarn start --reset-cache
4. Remove the cache: rm -rf /tmp/metro-*
2 | import { Animated, View, ViewProps } from 'react-native';
3 |
> 4 | let Screens: typeof import('react-native-screens') | undefined;
| ^
5 |
6 | try {
7 | Screens = require('react-native-screens');
編輯:我知道我可能需要該模塊。我已經檢查過了,它在那里,但它不起作用
uj5u.com熱心網友回復:
這是 React Navigation 需要的,它需要這個額外的模塊!只需遵循:https : //reactnavigation.org/docs/getting-started - 那里的檔案甚至在使用 expo 時指定了安裝。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/316879.html
上一篇:React和Typescript,警告:React.createElement:型別無效——需要一個字串但得到:未定義
