Clarifai / clarifai-javascript

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

TypeError: _$$_REQUIRE(_dependencyMap[4], "axios").post is not a function (it is undefined) #61

Open muhammad-kumail opened 9 months ago

muhammad-kumail commented 9 months ago

I'm using Clarifai in my React Native project. Essentially, I'm using react-native-camera to take a picture and then passing it to the Clarifai model to predict/identify objects in the picture. The picture is successfully taken and passed to the Clarifai model, but an error occurred in the following portion of the code.

    const Clarifai = require('clarifai');
    const app = new Clarifai.App({
      apiKey: 'my clarifai apiKey',
    });
    app.models
      .predict(Clarifai.GENERAL_MODEL, {base64: imageData})
      .then((response: any) =>
        displayAnswer(response.outputs[0].data.concepts[0].name),
      )
      .catch((err: any) => {
        alert(err);
        console.log('error:', err);
        setLoading(false);
      });

An error was caught in the .catch() statement. It seems like Axios is not imported correctly or the Axios package is not installed, but I have already installed the package. Below is my project's package.json dependencies:

    "axios": "^1.6.5",
    "clarifai": "^2.9.1",
    "react": "18.2.0",
    "react-native": "0.73.1",
    "react-native-camera": "^4.2.1"
muhammad-kumail commented 1 month ago

@inaam1122 Yes but I used alternative solution. Actually clarifai provides own documentation for this. they provided the javascript code for api call instead using any library and get prediction in api response. check this documentation https://documenter.getpostman.com/view/30622694/2s9YkuZdro#7d2b0bd1-9af0-4a3b-9f97-0f915d7d5d50

On Tue, Aug 20, 2024 at 8:45 PM inaam1122 @.***> wrote:

@muhammad-kumail https://github.com/muhammad-kumail did you find any solution??

— Reply to this email directly, view it on GitHub https://github.com/Clarifai/clarifai-javascript/issues/61#issuecomment-2299174580, or unsubscribe https://github.com/notifications/unsubscribe-auth/ANSLVIYSATNGZEL442WDARTZSNQB3AVCNFSM6AAAAABM2F6Z4OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJZGE3TINJYGA . You are receiving this because you were mentioned.Message ID: @.***>