Clarifai / clarifai-javascript

Official Clarifai JavaScript client for browsers and node.js
https://docs.clarifai.com
Other
351 stars 81 forks source link

Node dependency issue #14

Closed jwunder127 closed 7 years ago

jwunder127 commented 7 years ago

I had an issue with version 2.1.4dev (which is currently the default module on npm). I'm using Clarifai with react native; following import, I got this error:

UnableToResolveError: Unable to resolve module domain from /Users/user/Documents/projectname/node_modules/asap/raw.js: Module does not exist in the module map or in these directories: /Users/user/Documents/projectname/node_modules , /Users/user/node_modules This might be related to https://github.com/facebook/react-native/issues/4968 To resolve try the following:

  1. Clear watchman watches: watchman watch-del-all.
  2. Delete the node_modules folder: rm -rf node_modules && npm install.
  3. Reset packager cache: rm -fr $TMPDIR/react-* or npm start --reset-cache

The problem here is domain has been deprecated in node.js but is used in asap@2.0.5 (a dependency of promise@7.1.1, which itself is a dependency of clarifai @2.1.4-dev). I was able to get around this issue by using clarifai@2.0.9, which uses a different promise library (I'm using yarn, the command was: yarn add clarifai@2.0.9).

Here's a screenshot of the old dependency tree screen shot 2017-03-21 at 3 14 04 pm

and the new dependency tree: screen shot 2017-03-22 at 9 58 26 am

Summary: most recent clarifai release uses a library which uses a deprecated node module

manjeets12 commented 7 years ago

@jwunder127 are you able to successfully use this library in your react-native project.Actually I am trying to use this in one of my project I am getting following transform error, can you please help me to sort this out. I am just using this simple syntax

var Clarifai = require('clarifai');
var app = new Clarifai.App(
  '{clientId}', //my id
  '{clientSecret}' //my secret
);

screenshot_2017-03-31-05-04-57 1

manjeets12 commented 7 years ago

I solved my problem by installing version @2.0.9 and deleting .babelrc file from clarifai directory

ruie commented 7 years ago

I'm having the same issues with the latest version, i will try your solution @manjeets12

ibussieres commented 7 years ago

And for those of us who need a more recent version of the API ? We use the multi-language support that was rolled out in 2.1.2 I think. Any possible workaround ?

maxcell commented 7 years ago

Howdy all (@jwunder127 @manjeets12 @ruiehq @ibussieres)! I wanted to check in and see if all your concerns were resolved?

@manjeets12 You may need to install the babel-preset-es2015 package npm install babel-preset-es2015 --save. Let me know if since then your problem is resolved?

Specifically @ibussieres, I know that we introduced the multi-language support and I hope that in the latest build for 2.2.0, you have everything working?

ibussieres commented 7 years ago

Yes @maxcell , we're all good !