Ng2-charts: On Build, typo of import

Created on 29 May 2019  ·  18Comments  ·  Source: valor-software/ng2-charts

Angular V: 7.2.6;
ng2-charts: 2.2.4;

On build, terminal outputs warning with text:
WARNING in ./node_modules/ng2-charts/fesm5/ng2-charts.js 230:54-72 "export 'ɵɵdefineInjectable' was not found in '@angular/core'

In my node_module code, the following code relates to above error
import { Injectable, ɵɵdefineInjectable, ... } from '@angular/core';

Most Likely fix is
import { Injectable, defineIndejectable, ... } from '@angular/core';

Most helpful comment

i face to this issue too. i try to remove node_modules and install everything again. but it still not worked. for now i just run npm install [email protected] to downgrade ng2-charts to 2.2.3

i think it because it use angular 8 for compile this project.
in v8 defineIndejectable is deprecated. and replace with ɵɵdefineInjectable
but in v7 @angular/core don't has a ɵɵdefineInjectable

ref: https://angular.io/guide/deprecations#core

All 18 comments

Interesting, this must be from a dependency, because ng2-charts code doesn't import defineInjectable anywhere... I'll look into it

It appears to be a part of @angular/core - I think you have a mix of angular versions in your node_modules folder. Did you try to delete node_modules and repopulate it by running npm install ?

i face to this issue too. i try to remove node_modules and install everything again. but it still not worked. for now i just run npm install [email protected] to downgrade ng2-charts to 2.2.3

i think it because it use angular 8 for compile this project.
in v8 defineIndejectable is deprecated. and replace with ɵɵdefineInjectable
but in v7 @angular/core don't has a ɵɵdefineInjectable

ref: https://angular.io/guide/deprecations#core

Having the same issue with 2.2.4, running on Angular 7. Downgrading to 2.2.3 indeed solves the issue.

Probably Angular 8 support should be added in a new major/minor version, e.g. 2.3, to not break existing implementations (many people probably have "ng2-charts": "^2.2.0" or similar in their package.json, which will install 2.2.4 automatically).

This is extremely strange, there is virtually no difference between 2.2.3 and 2.2.4 except the relaxation of the peer dependency requirement, in 2.2.3 it is:

    "@angular/common": "^7.2.0",
    "@angular/core": "^7.2.0",

and in 2.2.4 it is:

    "@angular/common": "^7.2.0 || ^8.0.0",
    "@angular/core": "^7.2.0 || ^8.0.0",

This is the only difference...

@paviad i think it because package.json at root level (https://github.com/valor-software/ng2-charts/blob/development/package.json#L29) use angular v8, so when run ng build ng2-charts it use angular v8 for build.

The root level is just for the demo app, it is not distributed as part of the package. Make an empty folder do:

npm init
npm i ng2-charts

and look at node_modules
there's no trace of it

Can confirm that downgrading to 2.2.3 indeed solves the issue. Seems like it is impossible to support both Angular 7 and Angular 8 at the same time.

@paviad i think at root it not just a demo app. but it use to compile ng2-charts to library and publish at npm too. so when upgrade root level to v8. it use v8 compiler

i not quite sure. but i guess from npm run build:lib command
https://github.com/valor-software/ng2-charts/blob/development/package.json#L9

I face the similar problem too.

What should be the course of action? Reverting the change and bumping to 2.2.5, then reapplying the change into 2.3.0?

Closed by ec5e603

Hey @paviad this issue is still persisting, should we reopen the issue?

Can confirm that downgrading to 2.2.3 indeed solves the issue. Seems like it is impossible to support both Angular 7 and Angular 8 at the same time.

Yes! Downgrading to 2.2.3 fix the issue

Can you check for version 2.2.5? It is a rollback of the changes made
between 2.2.3 and 2.2.4, and is supposed to be identical to 2.2.3 again.

On Tue, Jun 4, 2019 at 9:40 PM Luis J. Centeno notifications@github.com
wrote:

Can confirm that downgrading to 2.2.3 indeed solves the issue. Seems like
it is impossible to support both Angular 7 and Angular 8 at the same time.

Yes! Downgrading to 2.2.3 fix the issue


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/valor-software/ng2-charts/issues/1115?email_source=notifications&email_token=AAJNV2DQWVK5IA2LO3B5CLTPY2ZJ5A5CNFSM4HQVJM3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODW5PUOI#issuecomment-498793017,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJNV2F4BF4RRFRVZOE6ALLPY2ZJ5ANCNFSM4HQVJM3A
.

@paviad for me 2.2.5 work like 2.2.3. but npm want to install latest version that match ^2.2.0, so it install 2.3.0 instead of 2.2.5

Change your semver selector to ~2.2.0 instead of ^2.2.0

On Wed, Jun 5, 2019 at 6:46 AM mix5003 notifications@github.com wrote:

@paviad https://github.com/paviad for me 2.2.5 work like 2.2.3. but npm
want to install latest version that match ^2.2.0, so it install 2.3.0
instead of 2.2.5


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/valor-software/ng2-charts/issues/1115?email_source=notifications&email_token=AAJNV2DY7I6P5FBFN4HNLI3PY4ZITA5CNFSM4HQVJM3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODW6QSTA#issuecomment-498927948,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAJNV2BUUOFU5ECRYIYO3I3PY4ZITANCNFSM4HQVJM3A
.

Hi, @paviad work with 2.2.5 but not work with 2.3.0

Was this page helpful?
0 / 5 - 0 ratings

Related issues

shenriksen4 picture shenriksen4  ·  3Comments

hggeorgiev picture hggeorgiev  ·  4Comments

alexcastillo picture alexcastillo  ·  5Comments

dslima90 picture dslima90  ·  3Comments

egervari picture egervari  ·  4Comments