npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

ng2charts error in ios

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 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 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)


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

(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:

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

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

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

I got an error

Module not found: Error: Can't resolve 'ng2-charts/ng2-charts' in '/Users/john/Documents/Sandpits/'

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.)

Thanks but i did the same and no change