Skip to content

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

@muhammad-kumail

Description

@muhammad-kumail

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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions