-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Module not found: Can't resolve '@react-native/assets-registry/registry' #21469
Comments
I'm also experiencing issues that might be related to this. Trying to use I follow the instructions here: https://docs.expo.dev/guides/using-nextjs/#font-support. Whenever I try to load a font I get the above error, and the underlying error is this:
I've been trying to debug this for a while, but didn't really get anywhere. Seems like an error for webpack parsing the flow syntax. Update: It works when downgrading to expo 47 |
Thank you for filing this issue! |
This is a showstopper for us on upgrade to 48 as well! |
Trying to do the expo tutorial and running into this |
Getting this as well after updating to 48 |
|
This solved my issue too! Thanks |
This didn't work for me unfortunately, but I think my issue is related to the combination of expo and next.js. Downgrading to expo 47, makes it work again with @expo/vector-icons. |
Having the same issue as @CruelMoney, installing Likely related to #20258 |
Having the same issue as @codinsonn, but with the module Uncaught Error node_modules/expo-asset/build/Asset.js (120:19)
|
We're blocked by this as well. Upgraded to Expo 48, ran In the CLI:
In our dev client:
|
# Why fix #21469 # How remove the `ReactNativeCompatibleAssetsRegistry` and import from `react-native/Libraries/Image/AssetRegistry` # Test Plan - ci passed - `npx expo export:web`
We are experiencing the same issue as @giaset reported. export const useCustomFonts = () => { console.log(error, fontsLoaded); return { then the following error occurs UPD: interesting that loading remote fonts is still working, so will use it as a temporary workaround to make app working. |
we've published |
@Kudo awesome! I'm happy to confirm that the issue is resolved now, thank you so much! Also, it seems that with this update there is no need to install |
thanks @danilovich 🎉 the |
@Kudo Thanks for the work 🙏 Just attempted to upgrade both expo-asset and expo itself, but the error previously mentioned is still there. I think it's probably a different issue than mentioned here, but it still seems related to assets-registry and expo 48. It's a bit of a complex project with next.js and using @expo/next-adapter. The error comes from next.js. Working on an example repo to reproduce the error. |
Hi there @Kudo 👋 Out of curiosity I created a fresh project, however it still seems to occur. Relevant package versions:
Any advice is appreciated 😄 |
Muito obrigado, isso resolveu meu problema de modo rápido, nota 10! |
@Jonatthu @anirudhsama did you fix the issue you mentioned cuz I have it too
|
@saeedblanchette yes I followed @Kudo 's advice and part of this issue as well facebook/react-native#36343 |
I made it work by patching registry.js diff --git a/node_modules/@react-native/assets/registry.js b/node_modules/@react-native/assets/registry.js
index 088187f..0a384d1 100644
--- a/node_modules/@react-native/assets/registry.js
+++ b/node_modules/@react-native/assets/registry.js
@@ -10,28 +10,16 @@
'use strict';
-export type PackagerAsset = {
- +__packager_asset: boolean,
- +fileSystemLocation: string,
- +httpServerLocation: string,
- +width: ?number,
- +height: ?number,
- +scales: Array<number>,
- +hash: string,
- +name: string,
- +type: string,
- ...
-};
-const assets: Array<PackagerAsset> = [];
+const assets = [];
-function registerAsset(asset: PackagerAsset): number {
+function registerAsset(asset) {
// `push` returns new array length, so the first asset will
// get id 1 (not 0) to make the value truthy
return assets.push(asset);
}
-function getAssetByID(assetId: number): PackagerAsset {
+function getAssetByID(assetId) {
return assets[assetId - 1];
} |
What's the Expo and RN version. Tried this but doesn't work |
I'm getting a similar problem ( |
I noticed the problems started after I upgraded to Expo 48. A potential solution could involve using an earlier version of Follow these steps to implement this fix:
"expo-asset": "^8.9.1",
"expo-asset-web": "npm:[email protected]" Bear in mind, we'll be employing distinct versions of
const createExpoWebpackConfigAsync = require('@expo/webpack-config');
module.exports = async function (env, argv) {
const config = await createExpoWebpackConfigAsync(env, argv);
// Insert the following code snippet: 👇
config.resolve.alias['expo-asset'] = 'expo-asset-web';
// Rest of your code...
return config;
};
#!/bin/sh
rm -rf node_modules/expo-asset-web/node_modules/@expo/config-plugins/build
"postinstall": "chmod +x ./postinstall.sh && ./postinstall.sh" This step is vital to ensure no conflict arises between
Now, you should be able to launch your project on the web without encountering any issues. |
You need to instruct whatever bundler you're using to transpile |
Patching @react-native/assets-registry worked for me! Cred to @nandorojo #21623 (comment) Summary
Steps:
|
## React native shipping Flow types breaks universal apps See: expo/expo#21623 (comment) expo/expo#21623 (comment) expo/expo#21469 (comment)
I have this in sdk 51 WARNING in ./node_modules/expo-asset/build/Asset.fx.js:6:4
WARNING in ./node_modules/expo-asset/build/Asset.js:149:9
web compiled with 1 error and 2 warnings |
I'm having the same issue too |
Hi friends, i have same the problem as you, so solution is that for me, npm i @react-native/assets-registry try this code command line. |
Im having the same issue with IS_ENV_WITH_LOCAL_ASSETS Also the @denisgoksel didn't work for me. |
Also getting this same warning on web |
Im having the same issue with IS_ENV_WITH_LOCAL_ASSETS |
it worked for me,, npm i @react-native/assets-registry yarn version; write this code to your command line. and my package.json like below, check it. { |
Same, @denisgoksel 's solution doesn't work for me either. I have a project that uses solito & tamagui and this error occurred while installing the |
Im same issue. Im trying to make my fonts and images loaded while on the splashscreen. ERROR Error loading resources: [Error: Module "9" is missing from the asset registry] //app.json "plugins": [
}, //app.js useEffect(() => { const loadResources = async () => { |
Regarding the issue with --- a/node_modules/expo-asset/build/PlatformUtils.web.js
+++ b/node_modules/expo-asset/build/PlatformUtils.web.js
export const IS_ENV_WITH_UPDATES_ENABLED = false;
+export const IS_ENV_WITH_LOCAL_ASSETS = false;
// Compute manifest base URL if available
export const manifestBaseUrl = null;
export function getManifest() { basically just add the missing const export - which is always going to be false because local assets are meaningless on web |
Has a PR been put up for this change mentioned @chriscoomber ? |
@dylansproule I've not made one - I don't really know for sure what this code is doing, I was just suggesting what fixed it for me. |
@dylansproule @chriscoomber ran into the same issue so I sent a PR: #29839 |
This has been fixed in the latest expo version from what i can tell! expo v51.0.14 |
@KrisLau It has not been fixed for me. I also get the issue with the missing crypto package so I don't know if the patch addresses that issue as well. |
@Arnavpmr you might wanna try running If that doesn't work, then your issue might be related to a different thing from the patch. |
@KrisLau I appreciate your suggestion but it didn't work unfortunately. I digged through the code for expo-asset in the npm repository and it wasn't updated with the latest patch. I believe that's probably why I'm not getting that patch so I can just wait for it to be rolled out to that package. |
I upgraded Expo SDK from 50 to 51 which broke assets loading The actual error was "ERROR TypeError: Cannot read property 'uri' of null... this pointed to a file in node_modules --> node_modules/expo-asset/build/Asset.js the null property was "virtualAssetModule" so, after googling "virtualAssetModule expo 51" I found this post on Reddit https://x.com/hirbod_dev/status/1798178985463181598?s=46&t=BJ6679qzsf66cZNyHJdrlA it mentioned "Upgraded from Expo 49 to 51 and local assets not loaded It also provided a solution from X (Twitter in the good ole days) https://x.com/hirbod_dev/status/1798178985463181598?s=46&t=BJ6679qzsf66cZNyHJdrlA add a resolution for "react-native/assets-registry": "0.74.83" because because "0.74.84" breaks assets loading! so now part of my package.json looks like this
after running "yarn" then stopping the server (ctrl-c on mac terminal) then running "yarn start" which in my case runs this script in package.json
the problem was fixed STRAIGHT AWAY! hope this helps someone |
Minimal reproducible example
https://github.com/suchcodemuchwow/Expo-Error
Summary
Whenever I use:
import { FontAwesome } from "@expo/vector-icons";
...
...
This gives me an error of:
Environment
expo-env-info 1.0.5 environment info:
System:
OS: macOS 13.2.1
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 18.13.0 - ~/.nvm/versions/node/v18.13.0/bin/node
npm: 9.4.2 - ~/.nvm/versions/node/v18.13.0/bin/npm
IDEs:
Xcode: /undefined - /usr/bin/xcodebuild
npmPackages:
@expo/webpack-config: ^18.0.1 => 18.0.1
expo: ~48.0.4 => 48.0.4
react: 18.2.0 => 18.2.0
react-dom: 18.2.0 => 18.2.0
react-native: 0.71.3 => 0.71.3
react-native-web: ~0.18.10 => 0.18.12
Expo Workflow: managed
The text was updated successfully, but these errors were encountered: