expo: Metro error: (0 , _expoModulesCore.uuidv4) is not a function

Minimal reproducible example

npx create-expo-app@latest Test -t tabs

Which package manager are you using? (Yarn is recommended)

npm

If the issue is web-related, please select the bundler (web.bundler in the app.json)

metro

Summary

Running the tabs template on the web throws:

Metro error: (0 , _expoModulesCore.uuidv4) is not a function

  2 | import { ExecutionEnvironment, } from './Constants.types';
  3 | const ID_KEY = 'EXPO_CONSTANTS_INSTALLATION_ID';
> 4 | const _sessionId = uuidv4();
    |                          ^
  5 | function getBrowserName() {
  6 |     if (Platform.isDOMAvailable) {
  7 |         const agent = navigator.userAgent.toLowerCase();

Call Stack
  <global> (node_modules/expo-constants/build/ExponentConstants.web.js:4:26)
  loadModuleImplementation (node_modules/metro-runtime/src/polyfills/require.js:342:5)
  guardedLoadModule (node_modules/metro-runtime/src/polyfills/require.js:240:12)
  metroRequire (node_modules/metro-runtime/src/polyfills/require.js:127:7)
  <global> (node_modules/expo-constants/build/Constants.js:4)
  loadModuleImplementation (node_modules/metro-runtime/src/polyfills/require.js:342:5)
  guardedLoadModule (node_modules/metro-runtime/src/polyfills/require.js:240:12)
  metroRequire (node_modules/metro-runtime/src/polyfills/require.js:127:7)
  <global> (node_modules/expo-router/src/link/linking.ts:1)
  loadModuleImplementation (node_modules/metro-runtime/src/polyfills/require.js:342:5)

Environment

expo-env-info 1.0.5 environment info: System: OS: macOS 13.5.1 Shell: 5.9 - /bin/zsh Binaries: Node: 18.16.0 - ~/.nvm/versions/node/v18.16.0/bin/node Yarn: 3.6.1 - ~/.nvm/versions/node/v18.16.0/bin/yarn npm: 9.5.1 - ~/.nvm/versions/node/v18.16.0/bin/npm Watchman: 2023.05.22.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.12.1 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4 Android SDK: API Levels: 28, 29, 30, 31, 33 Build Tools: 28.0.3, 29.0.1, 29.0.2, 29.0.3, 30.0.2, 30.0.3, 31.0.0, 31.0.0, 32.0.0, 33.0.0, 33.0.1 System Images: android-27 | Google Play Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom, android-30 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom, android-31 | Google Play ARM 64 v8a, android-31 | Google Play Intel x86 Atom_64, android-33 | Google APIs ARM 64 v8a, android-33 | Google Play ARM 64 v8a IDEs: Android Studio: 2021.3 AI-213.7172.25.2113.9123335 Xcode: 14.3.1/14E300c - /usr/bin/xcodebuild npmPackages: expo: ~49.0.10 => 49.0.10 react: 18.2.0 => 18.2.0 react-dom: 18.2.0 => 18.2.0 react-native: 0.72.4 => 0.72.4 react-native-web: ~0.19.6 => 0.19.8 npmGlobalPackages: eas-cli: 5.2.0 Expo Workflow: managed

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Reactions: 7
  • Comments: 17

Most upvoted comments

Running npx expo install --fix will fix this issue. There seems to be some mismatch between the expo packages and their versioning.

@Savinvadim1312 we fixed this by running npm i expo-modules-core@next. It seems there’s an issue with the latest release of that package (it’s under ‘next’ instead of ‘latest’)

Same error when use @clerk/clerk-expo

Thank you for your reply! I just managed to fix it by using expo install --fix.

I did NOT need to run npm run ios. NO ios folder necessary. It was enough to run eas build --platform ios --profile development-simulator --local --clear-cache Then install the build on your device (unzip and drop into simulator) Then you run the expo-dev-server and open the ios build! (not expo-go)

We are using a managed build but NOT expo go. Perhaps you can try the same?

@janwirth No!, cannot be fixed. I run the app without expo go. Example execute npm run android or ios. The web execute dont work with expo clerk.

@ansh In my case, the mismatch was caused by my package manager pulling expo-linking@6 while it is not compatible with SDK 49. I did not realise pnpm auto-installs peer dependencies by default since v8 and the thing is expo-router defines its peer dependency on expo-linking as *, so the latest version got installed 🙈.

When I explicitly required expo-linking@5.0.2 in my package.json and reinstalled all modules the issue was gone.

@dccarmo Using expo-modules-core@1.8 completely broke my app’s build, unfortunately. Glad it helped others though.

Im experiencing the same issue in a brand new Expo project so thank you for the temporary workaround @dccarmo