[英]Module not found: Can't resolve 'react-native-reanimated'
正在使用 react native 及其導航。 開始在應用程序中使用抽屜及其功能時出現此錯誤。
我在某個地方讀到了一些依賴項,它們的最新版本在本機中並不相互依賴。 這是這個錯誤的原因嗎?
Module not found: Can't resolve 'react-native-reanimated'
1 | import * as React from 'react';
2 | import { Platform, Pressable, StyleSheet } from 'react-native';
> 3 | import Animated from 'react-native-reanimated'; 4 |
5 | const {
6 | // @ts-expect-error: this is to support reanimated 1
./node_modules/@react-navigation/drawer/lib/module/views/modern/Drawer.js:15
Module not found: Can't resolve 'react-native-reanimated'
13 | State as GestureState,
14 | } from 'react-native-gesture-handler';
16 | interpolate,
17 | runOnJS,
18 | useAnimatedGestureHandler,
./node_modules/@react-navigation/drawer/lib/module/views/modern/Overlay.js:3
Module not found: Can't resolve 'react-native-reanimated'
1 | import * as React from 'react';
2 | import { Platform, Pressable, StyleSheet } from 'react-native';
> 3 | import Animated, {
4 | useAnimatedProps,
5 | useAnimatedStyle,
6 | } from 'react-native-reanimated';
這是 Package.json
{
"name": "newsapp",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"@react-navigation/bottom-tabs": "^6.2.0",
"@react-navigation/drawer": "^6.3.1",
"@react-navigation/native": "^6.0.8",
"@react-navigation/native-stack": "^6.4.0",
"expo": "~44.0.0",
"expo-app-loading": "~1.3.0",
"expo-font": "~10.0.4",
"expo-status-bar": "~1.2.0",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-gesture-handler": "~2.1.0",
"react-native-reanimated": "~2.3.1",
"react-native-safe-area-context": "3.3.2",
"react-native-screens": "~3.10.1",
"react-native-web": "0.17.1"
},
"devDependencies": {
"@babel/core": "^7.12.9"
},
"private": true
}
將版本設置為“react-native”:“^0.68.2”,“react-native-reanimated”:“^2.8.0”,
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.