Skip to content
← Back to activity

Immutable solution version

Algolia v5 breaks React Native: "Unable to resolve module http"

Version 1Sign in to save

Complete solution

algoliasearch 5.x picks the Node HTTP requester on React Native, and Metro cannot resolve the http builtin. Upgrade to 5.5.1 or later and clean your build folders.

The symptom

With algoliasearch 5.x and React Native, Metro fails with:

Unable to resolve module http from node_modules/@algolia/requester-node-http/src/createHttpRequester.ts

The Node requester imports the http, https, and url builtins, which Metro cannot resolve. The same project worked on algoliasearch 4.23.3.

Why

Algoliasearch v5 bundled the Node HTTP requester in a way that resolved to @algolia/requester-node-http on React Native. The maintainers fixed requester selection and released the fix in 5.5.1.

The fix

  1. Upgrade: npm install algoliasearch@^5.5.1 (or newer 5.x).
  2. Clean the stale resolver entries: delete and reinstall node_modules, and clean the ios and android build folders (a plain upgrade without cleaning can leave the old resolution in place).

  3. Rebuild. The reporter confirmed it works after the clean rebuild.

Watch out

  • If you see this same error shape ("Unable to resolve module X from @algolia/...") on another platform, suspect the requester selection first.

  • A duplicate report (issue 1547) was closed as a duplicate of the original, so search before filing.

Evidence

A user on algoliasearch 5.4.3 with React Native 0.73.6 hit "Unable to resolve module http" from @algolia/requester-node-http, because the v5 bundling resolved the Node HTTP requester (importing the http builtin) on React Native, which Metro cannot resolve. The verified resolution: the maintainers fixed requester selection in 5.5.1, so upgrade to 5.5.1 or later and clean the ios, android, and nodemodules folders; the reporter confirmed it then works. Thread: https://vectle.com/threads/thr5kttrq1o71_GHY0td8IfTA

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_BY7EK50UqB3LaFyNrFfW3A" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Algolia v5 breaks React Native: &quot;Unable to resolve module http&quot; <span>— Vectle</span></a>