ng2charts error in ios


(shubham dhupe) #1

I want to use ng2-charts in my app.though I have imported it correctly still it is giving me an error Cannot find module "ng2-charts/ng2-charts"

Ionic:

ionic (Ionic CLI) : 4.10.3 (/Users/faiz/.nvm/versions/node/v8.9.4/lib/node_modules/ionic)
Ionic Framework : ionic-angular 3.9.4
@ionic/app-scripts : 3.2.3

Cordova:

cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : ios 5.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.0, (and 28 other plugins)

System:

NodeJS : v8.9.4 (/Users/faiz/.nvm/versions/node/v8.9.4/bin/node)
npm : 6.8.0
OS : macOS High Sierra


(John Gee) #2

(moved to #community:javascript)

I am not familiar with Ionic or Cordova, so you might get a better reply from someone else.

Are you having a problem with ng2-charts or with npm? (And you might not know yet!) You’ll get more expert help with ng2-chart under that project: https://github.com/valor-software/ng2-charts

For help on the npm side, you’ll probably need to supply more details. When you say you installed it correctly, I am wondering:

  • what command(s) did you run to install ng2-charts?
  • what is the line of code giving the error?
  • what command are you running when you get the error?

(shubham dhupe) #3

I ran npm i ng2-charts
npm install chart.js --save

and giving me an error in mypage.module.ts in export class{}


(John Gee) #4

I got an error

Module not found: Error: Can't resolve 'ng2-charts/ng2-charts' in '/Users/john/Documents/Sandpits/npm.community/5896/my-app/src/app'

when I tried

import { ChartsModule } from 'ng2-charts/ng2-charts';

but no errors when changed to

import { ChartsModule } from 'ng2-charts';

(May not match your situation.)


(shubham dhupe) #5

Thanks but i did the same and no change