Importing Algorthmia into React-Native but receiving "Module does not exist..." error

385 Views Asked by At

I'm trying to include the Algorithmia client into my React-Native application and for some reason I keep hitting a "Module does not exist in the module map" error. I've followed the suggestions in the error and have Cleared Watchman watches, deleted and reinstalled node_modules, Reset Metro Bundler Cache and Removed the haste cache and still no luck.

Is there something I'm overlooking or unaware of?

I followed steps for installation from the Algorithmia docs

npm install --save algorithmia

and at the top of my AlgoComponent.js

import React, { Component } from 'react';
import { View, StyleSheet, Image, Dimensions, TouchableHighlight, Text } from 'react-native';
import LinearGradient from 'react-native-linear-gradient';
import Algorithmia from 'algorithmia';

other styles i've tried:

import * as Algorithmia from 'algorithmia';
import { Algorithmia } from 'algorithmia';

I've looked around quite a bit, but so far no luck. Any suggestions would be greatly appreciated!

Update: 1/16/2018 - I didn't quite grasp that React-Native isn't truly node, since it's compiling to Objective C and Swift (might not have said that exactly right, but thats the gist). Maybe this is the issue I'm hitting since I was following the node docs? In the meantime I've set up an express server that will sit between my Native App and Firebase and am planning to make the calls to Algorithmia from there. I'll update as I get further along.

Final Update: 3/19/2018 - Unless another way opens up, I've decided to continue using the express server routing I set up in January. Seems to be working just fine.

0

There are 0 best solutions below