Home Forums Chart Support @canvasjs/react-charts not found

@canvasjs/react-charts not found

Viewing 4 posts - 1 through 4 (of 4 total)
  • #44351

    Hello everyone,

    I’m trying to install CanvasJS React Charts in my ts project. I runned “npm install @canvasjs/react-charts” and i got “@canvasjs” repository in my “node-modules”, but when i did:

    “import CanvasJSReact from ‘@canvasjs/react-charts’;”

    i got this error:

    “The declaration file for the ‘@canvasjs/react-charts’ module cannot be found. …/node_modules/@canvasjs/react-chart
    /canvasjs.react.js’ implicitly has an ‘any’ type.”

    Could you help me to fix this error please.

    #44352

    @fatemk,

    We don’t have CanvasJS React Charts TypeScript definition as of now. However, charts seems to work fine with React TypeScript as-well. You can ignore the corresponding error by adding // @ts-ignore above the import statement as shown in the code-snippet below.

    // @ts-ignore
    import CanvasJSReact from '@canvasjs/react-charts';

    __
    Sachin Bisht
    Team CanvasJS

    #44353

    Thank you for your replay and your time,

    I did what you told to me and that worked to ingnore ts file. But unfortunately i got a new error :

    ERROR in ./node_modules/@canvasjs/react-charts/canvasjs.react.js 20:15-42
    Module not found: Error: Can’t resolve ‘@canvasjs/charts’ in ‘…\node_modules\@canvasjs\react-charts’

    I think the function “var CanvasJS = require(‘@canvasjs/charts’)” line 20 in the file “canvasjs.react.js” doesn’t work for me but i’m not sure.

    #44372

    @fatemk,

    Kindly create a sample project reproducing the issue you are facing and share it with us over Onedrive / Google-Drive, so that we can run the sample locally at our end to understand the scenario better and help you out.

    __
    Sachin Bisht
    Team CanvasJS

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.