Search code examples
react-nativeexporeact-native-pager-view

'Unable to resolve module ../Utilities/Platform' after installing react-native-pager-view


Error would only appear after installing react-native-pager-view and would disappear after uninstalling it.

Below is the complete error code

Unable to resolve module ../Utilities/Platform from 
{file_path_of_my_app}\node_modules\react-native\Libraries\ReactNative\PaperUIManager.js: 

None of these files exist:
* node_modules\react-native\Libraries\Utilities\Platform(.web.ts|.ts|.web.tsx|.tsx|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css)
* node_modules\react-native\Libraries\Utilities\Platform\index(.web.ts|.ts|.web.tsx|.tsx|.web.js|.js|.web.jsx|.jsx|.web.json|.json|.web.cjs|.cjs|.web.scss|.scss|.web.sass|.sass|.web.css|.css)

Dependencies below:

"dependencies": {
"@expo/vector-icons": "^13.0.0",
"@ptomasroos/react-native-multi-slider": "^2.2.2",
"@react-navigation/native": "^6.0.2",
"@shopify/react-native-skia": "0.1.196",
"expo": "~49.0.15",
"expo-font": "~11.4.0",
"expo-linear-gradient": "~12.3.0",
"expo-linking": "~5.0.2",
"expo-router": "^2.0.0",
"expo-splash-screen": "~0.20.5",
"expo-status-bar": "~1.6.0",
"expo-system-ui": "~2.4.0",
"expo-web-browser": "~12.3.2",
"moment": "^2.30.1",
"nativewind": "^2.0.11",
"react": "18.2.0",
"react-dom": "18.2.0",
"react-native": "0.72.6",
"react-native-animated-pagination-dots": "^0.1.43",
"react-native-countdown-circle-timer": "^3.2.1",
"react-native-deck-swiper": "^2.0.16",
"react-native-gesture-handler": "~2.12.0",
"react-native-modal": "^13.0.1",
"react-native-pager-view": "^6.2.0",
"react-native-reanimated": "^3.3.0",
"react-native-reanimated-carousel": "^3.5.1",
"react-native-safe-area-context": "4.6.3",
"react-native-screens": "~3.22.0",
"react-native-svg": "13.9.0",
"react-native-virtualized-view": "^1.0.0",
"react-native-web": "~0.19.6"
}

Solution

  • I'm guessing you're trying to use the "react-native-pager-view" module with the web build. If that is the case, unfortunately, that module is not available for the web build.

    See https://docs.expo.dev/versions/latest/sdk/view-pager/