-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
Unable to resolve module missing-asset-registry-path #38282
Comments
Hi, we're going to need a bit more information to be helpful. Here are some things you can do in the interim to unblock yourself:
If you think this is a more general issue and not specific to your setup, can you provide a minimum reproducible example? |
|
@blakef the project is too old , i am sure the issue is an metro.config , here is the config file , please have a look ,the issue is only with png images module.exports = (async () => {
const {
resolver: { sourceExts, assetExts },
} = await getDefaultConfig();
return {
transformer: {
babelTransformerPath: require.resolve('react-native-svg-transformer'),
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
resolver: {
assetExts: assetExts.filter(ext => ext !== 'svg'),
sourceExts: [...sourceExts, 'svg'],
},
};
})(); react-native Config File module.exports = {
project: {
ios: {},
android: {}, // grouped into "project"
},
assets: ["./src/assets/fonts/"], // stays the same
}; |
Potentially related to react-navigation/react-navigation#11192 @MajidAziz3 without a repro we can't really help further. |
@MajidAziz3 Your |
Duplicate of facebook/metro#1028. |
I had to downgrade react-native version from 0.73 to 0.68. And node version from v20 to v16.20.0. |
I am facing this with jpg, yet png is fine. |
This config works.
|
@Leslie-Wong-H thank you, you saved me |
Omg finally it works. I was using an old config and I moved to react native 7.3.0 and this update is required or the archive will fail |
I meet an error , pls help . thanks ! here is the error stack: [TypeError: _$$_REQUIRE(_dependencyMap[7], "(...)ssets-registry/path-support.js") is not a function (it is Object)] {"componentStack": " |
error: Error: Unable to resolve module missing-asset-registry-path from D:\Hoverin Aerospace\HoverinApp\node_modules\react-native\Libraries\LogBox\UI\LogBoxImages\close.png: missing-asset-registry-path could not be found within the project or in these directories:
|
|
same error after upgrading to expo50
This is example with almost empty index.js file |
but why there are a lot of issues about the upgrading of expo 50? @expo please fix it |
(Expo SDK 50) Every solution didn't work for me, but I solved missing-asset-registry-path issue by below custom metro config. // Learn more https://docs.expo.io/guides/customizing-metro
const { getDefaultConfig } = require('expo/metro-config');
/** @type {import('expo/metro-config').MetroConfig} */
const config = getDefaultConfig(__dirname);
config.transformer = {
...config.transformer,
babelTransformerPath: require.resolve('react-native-svg-transformer'),
assetPlugins: ['expo-asset/tools/hashAssetFiles'],
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: true,
},
}),
};
//
config.resolver = {
...config.resolver,
assetExts: config.resolver.assetExts.filter((ext) => ext !== 'svg'),
sourceExts: [...config.resolver.sourceExts, 'svg', 'd.ts'],
};
module.exports = config; |
with png. none of the above metroconfig is working for. what can i do? Unable to resolve "./assets/logo.png" from "screens\Startscreen.js" |
This worked for me! Thank you! |
This worked for me as well. |
This worked for me and remember to re-start the metro |
I cannot get over this issue for png files after updating to expo sdk 51 :( |
Bro, you made my day. Thanks, it worked for the png issue! |
+1 |
saved my day, thanks! If someone is running turborepo, this config worked for me
|
make sure to start metro with --reset-cache |
I am also facing the same issue is there anyone who can help me ? |
Using the Metro bundler with React Native requires enabling package exports ([docs](https://metrobundler.dev/docs/package-exports/)) via a Metro config file. This adds said file and some necessary dependencies. Note that we also spell this out in our Protobuf-ES [docs](https://github.com/bufbuild/protobuf-es/blob/main/MANUAL.md#parcelmetro-fails-to-resolve-imports). It seems odd to have to use the `react-native-svg-transformer` here. But without it, we get asset errors. This combination here appears to be the right incantation to get things to work. Taken from this [issue](facebook/react-native#38282). --------- Signed-off-by: Steve Ayers <sayers@buf.build>
thank you so much it work |
Cool, still works on 0.76.5. Thanks! |
Description
error Unable to resolve module missing-asset-registry-path from path/src/assets/image.png: missing-asset-registry-path could not be found within the project or in these directories:
node_modules
React Native Version
0.72.1
Output of
npx react-native info
System:
OS: macOS 13.4
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Memory: 52.41 MB / 8.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 20.2.0
path: /usr/local/bin/node
Yarn:
version: 1.22.19
path: /usr/local/bin/yarn
npm:
version: 9.6.6
path: /usr/local/bin/npm
Watchman:
version: 2023.05.22.00
path: /usr/local/bin/watchman
Managers:
CocoaPods:
version: 1.12.1
path: /Users/apple/.rubies/ruby-3.2.2/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 22.4
- iOS 16.4
- macOS 13.3
- tvOS 16.4
- watchOS 9.4
Android SDK: Not Found
IDEs:
Android Studio: 2022.2 AI-222.4459.24.2221.9971841
Xcode:
version: 14.3.1/14E300c
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.7
path: /usr/bin/javac
Ruby:
version: 3.2.2
path: /Users/apple/.rubies/ruby-3.2.2/bin/ruby
npmPackages:
"@react-native-community/cli":
installed: 11.3.5
wanted: ^11.3.5
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.1
wanted: 0.72.1
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false
Steps to reproduce
Error coming while running Apk bundling commands npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
Snack, code example, screenshot, or link to a repository
command for bundling assets: npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
The text was updated successfully, but these errors were encountered: