google / chatbase-node

Quickly integrate your Node.js chatbot with Chatbase Analytics
Apache License 2.0
78 stars 24 forks source link

Issue with using this with react native #17

Open Nandez89 opened 6 years ago

Nandez89 commented 6 years ago

Hello,

I was wondering if this is compatible with React Native or if you can point me in the right direction. Trying to use the lib... I installed it using the npm command but I get the following error when I try to run my app. Every time I include the line:

var chatbase = require('@google/chatbase')

I get this error, so I haven't been able to use the lib

Bundling `index.js`  [development, non-minified]  22.3% (123/1345), failed.
error: bundling failed: UnableToResolveError: Unable to resolve module `events` from `/user/helloproject/node_modules/@google/chatbase/node_modules/got/index.js`: Module does not exist in the module map

Could you help me get some direction on how to address this

cristiancavalli commented 6 years ago

Hmm, @Nandez89 I haven't used this with react native but it looks like it is failing to import the events module for Node.js for the Got library which looks like it's being imported here: https://github.com/sindresorhus/got/blob/master/index.js#L2

Seems to be a known issue: https://github.com/facebook/react-native/issues/11498

With specifics about the events module here: https://github.com/Leonidas-from-XIV/node-xml2js/issues/363

Please lmk if that isn't helpful

Nandez89 commented 6 years ago

@cristiancavalli Thanks for the fast reply, I have tried the workaround suggested in your references and still get the same error.

I was wondering if maybe the chatbase-node is not intended to work for react native or needs some adjustments to make it compatible. if it's not compatible then I'd rather not spend much time stuck in this until there's a solution.

cristiancavalli commented 6 years ago

Hey @Nandez89 --

Sorry that didn't work out. There's nothing we've put into the module (that we know of) that conflicts directly with React native. The error, also, seems to be coming from a dependent library (Got) and everything that I have seen so far does not indicate that Got shouldn't work with react native. I'll keep looking into it and try to help in any way I can. Please ping this thread if you find anything on your end.

Cheers, Cris