Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WARNING in ./node_modules/ng2-charts/fesm5/ng2-charts.js 230:54-72 "export 'ɵɵdefineInjectable' was not found in '@angular/core'

I am using ng2-charts in Angular 7 app and having warning

WARNING in ./node_modules/ng2-charts/fesm5/ng2-charts.js 230:54-72 "export 'ɵɵdefineInjectable' was not found in '@angular/core'

error in VS Code

enter image description here

error in browser

enter image description here

What could be the reason and how to resolve it?

like image 918
WasiF Avatar asked May 30 '19 03:05

WasiF


2 Answers

Update: May 2021

Recently I have used [email protected] in Angular v11 and it's working fine. You may try with the latest version

npm install ng2-charts@latest // it will automatically install latest version 

Older

ng2-charts v2.2.4 has this bug as lots of users are reporting that so down-grading to ng2-charts v2.2.3 is fine until it is fixed in the future releases.

npm install [email protected] 
like image 72
WasiF Avatar answered Sep 30 '22 16:09

WasiF


Right, you have to do npm install [email protected] --save Also, check into your package.json for "ng2-charts": "2.2.3", I also faced same issue but previously I had "ng2-charts": "^2.2.3", so I removed caret (^). It means "Compatible with version" it will install major version. But use "Fixed version" if you don't want to change version of package on each installation.

like image 30
Mayur Saner Avatar answered Sep 30 '22 17:09

Mayur Saner