簡體   English   中英

找不到模塊:安裝 React Native Gesture Handler 時無法解析“@egjs/hammerjs”

[英]Module not found: Can't resolve '@egjs/hammerjs' while installing React Native Gesture Handler

我收到錯誤

找不到模塊:無法解析“@egjs/hammerjs”

在嘗試在 Expo Run React Native 應用程序中導入“react-native-gesture-handler”時。

我已經嘗試過expo install @types/hammerjsexpo install @types/hammerjs並在我的應用程序中import hammer ,但它仍然拋出錯誤。

我正在使用 Hammer.JS 2.0.8版和 React Native Gesture Handler 1.5.0

我遇到了同樣的問題,不得不卸載 react-native-gesture-handler npm uninstall react-native-gesture-handler通過 npm 安裝它,而不是 expo npm i react-native-gesture-handler現在是 1.6.1 版。

這對我有用,但它會觸發一條警告消息Some of your project's dependencies are not compatible with currently installed expo package version: - react-native-gesture-handler - expected version range: ~1.5.0 - actual version installed: ^1.6.1 Your project may not work correctly until you install the correct versions of the packages. To install the correct versions of these packages, please run: expo install [package-name ...] Some of your project's dependencies are not compatible with currently installed expo package version: - react-native-gesture-handler - expected version range: ~1.5.0 - actual version installed: ^1.6.1 Your project may not work correctly until you install the correct versions of the packages. To install the correct versions of these packages, please run: expo install [package-name ...]

但是,如果您使用 expo expo install react-native-gesture-handler您將得到相同的Module not found: Can't resolve '@egjs/hammerjs'問題。 因此,我想這是一個短期修復,但有效。

我的 expo-cli 是 3.15.5 版

這是我當前的依賴項"dependencies": { "@react-native-community/masked-view": "0.1.5", "expo": "^36.0.0", "expo-av": "~8.0.0", "react": "16.9.0", "react-dom": "16.9.0", "react-native": "https://github.com/expo/react-native/archive/sdk-36.0.1.tar.gz", "react-native-gesture-handler": "^1.6.1", "react-native-safe-area-context": "0.6.0", "react-native-safe-area-view": "^1.0.0", "react-native-screens": "2.0.0-alpha.12", "react-native-web": "^0.11.7", "react-navigation": "^4.1.1", "react-navigation-stack": "^2.1.1" },所以不需要安裝@types/hammerjs 作為依賴。

我希望它有幫助!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM