Unable to resolve "expo-random" from "node_modules/expo-auth-session/build/PKCE.js"

  1. SDK 40:
  2. Platforms(Android/iOS):

After upgrade expo from 39 to 40 got problem "Unable to resolve “expo-random” from “node_modules/expo-auth-session/build/PKCE.js”.

Expo-auth-session was updated automatically that is all I understand by now. Any ideas?

What version of npm are you using? Please paste the output of expo diagnostics here.

Also, could you paste the whole error message, please?

I’m using npm v 6.14.6

Output of expo diagnostics:
Expo CLI 3.23.3 environment info:
System:
OS: Linux 5.4 Ubuntu 18.04.4 LTS (Bionic Beaver)
Shell: 4.4.20 - /bin/bash
Binaries:
Node: 12.18.3 - /usr/local/bin/node
npm: 6.14.6 - /usr/local/bin/npm
IDEs:
Android Studio: 4.0 AI-193.6911.18.40.6626763
npmPackages:
expo: ^40.0.0 => 40.0.0
react: 16.13.1 => 16.13.1
react-dom: 16.13.1 => 16.13.1
react-native: https://github.com/expo/react-native/archive/sdk-40.0.0.tar.gz => 0.63.2
react-native-web: ~0.13.12 => 0.13.18
npmGlobalPackages:
expo-cli: 3.23.3

Whole error message:
Unable to resolve module expo-random from node_modules/expo-auth-session/build/PKCE.js: expo-random 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: rm -rf node_modules and run yarn install
  3. Reset Metro’s cache: yarn start —reset-cache
  4. Remove the cache: rm -rf /tmp/metro-*

ABI40_0_0facebook::ABI40_0_0React::JSIExecutor::defaultTimeoutInvoker(std::__1::function<void ()> const&, std::__1::function<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > ()>)
ABI40_0_0facebook::ABI40_0_0React::JSIExecutor::defaultTimeoutInvoker(std::__1::function<void ()> const&, std::__1::function<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > ()>)
6C143C51-288F-3CD0-84DD-17B9A0AAEE62
6C143C51-288F-3CD0-84DD-17B9A0AAEE62
6C143C51-288F-3CD0-84DD-17B9A0AAEE62
96F8386D-D88A-3C89-A323-A17975C3317F
96F8386D-D88A-3C89-A323-A17975C3317F
CFRunLoopRunSpecific
GSEventRunModal
71B59F62-19DA-3CFF-89E1-DACF333BAB0D
UIApplicationMain
Exponent
E31C0887-C999-3047-9B80-203248EC2396

On android emulator problem the same but have another description

Ah, it looks like you now have to install expo-random manually:

so the following should fix it:

expo install expo-random

I assume you used expo upgrade to do the upgrade?

Thank you so much, this solution solved my problem. Yes I used expo upgrade.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.