-
Notifications
You must be signed in to change notification settings - Fork 222
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 'url'
when using algoliasearch
in React Native with Metro bundler
#1547
Comments
Hi, thanks for your report. I've transferred the issue to the relevant repository so the team can look at it. In the meantime, you should be able to use |
Hey @bruhmaa do you use an old metro version maybe? It seems related to expo/expo#21896 Metro shouldn't resolve the node export but the browser one https://github.com/algolia/algoliasearch-client-javascript/blob/main/packages/algoliasearch/package.json#L30 |
Hi, I have the same issue following the React Native tutorial and running the app using Expo Go inside an iOS simulator. algoliasearch Version: 5.3.0 - react-instantsearch-core Version: 7.13.0 |
Im also facing the same issue in latest react native 0.75.2. Is there any solution?
|
Hey there, I'm releasing the 5.4.0 which should hopefully resolve this issue, don't hesitate to let me know if it's not the case! |
hello , thanks for the update. However issue still remains same. error: Error: Unable to resolve module http from /Volumes/DATA/projects/pola/app/node_modules/@algolia/requester-node-http/src/createHttpRequester.ts: http could not be found within the project or in these directories:
"dependencies": { |
Seems like a resolution issue? https://metrobundler.dev/docs/package-exports/ |
Hello, i reinstalled all yarn packages and still the issue persists. any suggestions? |
Hey @charithnidarsha, have you enabled the option here https://metrobundler.dev/docs/package-exports/#configuration-options? |
my metro.config file is as below. const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config'); /**
const config = { module.exports = mergeConfig(getDefaultConfig(__dirname), config); Now the error is error: Error: Unable to resolve module url from /Volumes/DATA/projects/pola/app/node_modules/axios/dist/node/axios.cjs: url could not be found within the project or in these directories:
|
Hey @charithnidarsha, we don't use axios in this repository so I guess it's related to an other package? |
🐛 Current behavior
I'm encountering an issue while using the
algoliasearch
package in a React Native app. The error occurs when Metro bundler tries to resolve theurl
module, which is not found within the project ornode_modules
.Error:
The issue seems to be that React Native's Metro bundler cannot resolve the
url
module, which is part of Node.js' core modules. This problem occurs specifically in the fileechoRequester.ts
from the@algolia/requester-node-http
package, which imports theURL
class fromurl
.🔍 Steps to reproduce
url
module.Live reproduction
React InstantSearch
💭 Expected behavior
The
algoliasearch
package should not rely on Node.js core modules likeurl
, which are not available in React Native environments.Package version
algoliasearch Version: 5.2.5 - react-instantsearch-core Version: 7.13.0
Operating system
macOS 14.6.1
Browser
Google Chrome
Code of Conduct
The text was updated successfully, but these errors were encountered: