React-instantsearch: Unable to resolve module 'crypto'

Created on 10 Sep 2017  ·  3Comments  ·  Source: algolia/react-instantsearch

I am currently trying to implement react-instantsearch into my React Native Project and am running into a fatal build issue. I am getting an error that I am unable to resolve a module called "crypto". I tried to get around it by installing crypto into my project but still got the same error. I haven't seen any reference to an error similar to this on any sources online so I imagine it is a new node dependency

Here is a screenshot of the error that I am getting:
screen shot 2017-09-09 at 8 47 48 pm

Here is a screenshot of the package.json for my project
screen shot 2017-09-09 at 9 01 53 pm

I have also tried installing algoliasearch: "^3.24.2" but still get that error.

PS when I take out the react-instantsearch package from my package.json it will build.

Any ideas?

❔ Question

Most helpful comment

Hi @markmiller21,

I recently tried (last week) using expo 20.0.0 and React 16.0.0-alpha.12 with React InstantSearch 4.1.0 and everything was working fine.

Some things that I can see is the import of the InstantSearch component. Are you importing it like:

import { InstantSearch } from 'react-instantsearch/native';

One other test you can do is trying to launch our expo example app and tell us if it work? => https://github.com/algolia/react-instantsearch/tree/master/packages/react-instantsearch/examples/react-native

All 3 comments

Hi @markmiller21,

I recently tried (last week) using expo 20.0.0 and React 16.0.0-alpha.12 with React InstantSearch 4.1.0 and everything was working fine.

Some things that I can see is the import of the InstantSearch component. Are you importing it like:

import { InstantSearch } from 'react-instantsearch/native';

One other test you can do is trying to launch our expo example app and tell us if it work? => https://github.com/algolia/react-instantsearch/tree/master/packages/react-instantsearch/examples/react-native

I created a MVCE using the newest version of Expo and I found that it was working. After doing this I upgraded my expo version and it solved the issues that I was having. Thanks for the help :)

FWIT: I was on Expo V17.0.0 & upgraded to Expo V20.0.0. The instantSearch component stopped producing the node module error on V19.0.0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

afgoulart picture afgoulart  ·  4Comments

flouc001 picture flouc001  ·  4Comments

aaronbushnell picture aaronbushnell  ·  4Comments

danhodkinson picture danhodkinson  ·  3Comments

econner picture econner  ·  3Comments