expo: SDK45: Unable to resolve module uuid/v5 in expo go
Summary
Initializing a new sdk45 beta project and using “uuid” in expo go throws the following error
iOS Bundling failed 1021ms
Unable to resolve module uuid/v5 from {file paths}/node_modules\expo\build\environment\getInstallationIdAsync.js: uuid/v5 could not be found within the project or in these directories:
node_modules\expo\node_modules
node_modules
1 | import * as Application from 'expo-application';
> 2 | import uuidv5 from 'uuid/v5';
| ^
3 | let installationId;
4 | const UUID_NAMESPACE = '29cc8a0d-747c-5f85-9ff9-f2f16636d963'; // uuidv5(0, "expo")
5 | export default async function getInstallationIdAsync() {
Managed or bare workflow? If you have ios/
or android/
directories in your project, the answer is bare!
managed
What platform(s) does this occur on?
iOS
SDK Version (managed workflow only)
SDK45
Environment
expo-env-info 1.0.3 environment info:
System:
OS: Windows 10 10.0.19044
Binaries:
Node: 16.14.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.17 - ~\AppData\Roaming\npm\yarn.CMD
npm: 8.3.1 - C:\Program Files\nodejs\npm.CMD
npmPackages:
expo: ~45.0.0-beta.4 => 45.0.0-beta.8
react: 17.0.2 => 17.0.2
react-dom: 17.0.2 => 17.0.2
react-native: 0.68.1 => 0.68.1
react-native-web: 0.17.1 => 0.17.1
Expo Workflow: managed
Reproducible demo
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 4
- Comments: 20 (4 by maintainers)
I ran into the same issue and ended up here. I managed to solve it for myself, but I don’t understand the root cause of the problem. I’m also on a yarn workspaces monorepo.
the expo package requires
"uuid": "3.4.0"
, but for some reason, the npm install doesn’t install that version.react-scripts
from my web project (same monorepo) requires a higher version, and I think because all the sub dependencies go into the root project’snode_modules
,3.4.0
gets clobbered by the higher version depended on byreact-scripts
. You can take a look by runningnpm list uuid
.My fix was just to add
"uuid": "3.4.0"
to my expo project’s package.json. That makes sure it’s at least installed in the mobilenode_modules
(not../node_modules
), and metro will find it there. Hope that makes sense.fixed in
expo@45.0.0-beta.9
I discovered that by removing another package in the monorepo which had uuid as a dependency, the issue went away. However, removing uuid in that package wasn’t an option. The only thing that has solved the issue has been setting
config.resolver.disableHierarchicalLookup
to false inmetro.config.js
, going against what is recommended in the docs. Still looking for a better solution, if anyone has one.Really seems like this should be reopened if people are still experiencing it? (hint: I am) Trying to upgrade my app’s expo version to 49 is causing it for me.
For anyone who runs into this same problem, I got this exact error in a yarn monorepo where another package had included uuid version 8.3.2. Removing that solved the issue.
I’m running a yarn 3 monorepo. Seems like Expo is using a quite old version of uuid. Another fix that I found to this is to add
"uuid": "^3.4.0"
into your root package.json’s resolution.I’m not too sure what new breaking features have come out between v3.4 and v9. So, double check this doesn’t break your other package/apps code!
Just encountered this issue (again) in Expo version 49.
Although i am pretty sure this is case-by-case issue at this point, I fixed this by “downgrading” Expo to v49.0.0 (my last version was 49.0.6)
Don’t know what is cooking here but hope it helps
found another issue related to uuid usage, created an issue here https://github.com/expo/expo/issues/17270
you can work around this by using
expo-standard-web-crypto
instead ofreact-native-get-random-values
:in a yarn monorepo i had to set this:
config.resolver.disableHierarchicalLookup = false;
contrary to the docs which says this should be set to true.I tried to run spacedrive mobile-app but got issue like here posted.
For ios, I got
Unable to resolve "uuid/v5" from "../../node_modules/expo/build/environment/getInstallationIdAsync.js"
For android, I got
Error: crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported, js engine: hermes
Tried some actions by above posted:
By “setting config.resolver.disableHierarchicalLookup to false in metro.config.js” works for me.
By “adding
"uuid": "^3.4.0"
into your root package.json’s resolution” did not fix for me.By “adding
"uuid": "^3.4.0"
to my expo project’s package.json” did not fix for me.The following patch can be used as a workaround
I can confirm this also works for me, in a pnpm monorepo, with expo version
49.0.18
.Adding an override into the root
package.json
did it for me (Though may cause other problems for anything that depends on a different versionI was experiencing the same issue following the expo documentation and using version 49, what actually did work was setting
Mentioned in