Clarifai api referenceerror : process is not defined

Viewed 247

I get such an error on npm start on clarifai api [1]: https://i.stack.imgur.com/pHRNz.png

Open bootstrap:27:

    // Execute the module function
    try {
        var execOptions = { id: moduleId, module: module, factory: __webpack_modules__[moduleId], require: __webpack_require__ };
        __webpack_require__.i.forEach(function(handler) { handler(execOptions); });
        module = execOptions.module;
        execOptions.factory.call(module.exports, module, module.exports, execOptions.require);
    } catch(e) {
        module.error = e;
        throw e;
    }

    // Flag the module as loaded
    module.loaded = true;

    // Return the exports of the module
    return module.exports;
}

and my App.js details;

const app = new Clarifai.App({
  apiKey: '****',
})
 
///

  onButtonSubmit = () => {
    console.log('click')
    app.models
      .predict(
        '45fb9a671625463fa646c3523a3087d5',
        'https://samples.clarifai.com/metro-north.jpg'
      )
      .then(
        function (response) {
          console.log(response)
        },
        function (err) {
          //
        }
      )
  }

I am getting this error before render in console.log. what would be the reason?

Happy coding day! :)

1 Answers

As stated in the documentation you need to use Broserify. You are missing NodeJS globals. Please let us know if this does not work for you as this library is unfortunately not under active maintenance currently.

Related