Jobs
Jobs

Reputation: 259

why I'm getting "UNMET PEER DEPENDENCY" error in angular 2

I'm trying to install angular2-flash-messages to my angular-src, not to the root. then I tried with npm install angular2-flash-messages. then it returns this,

├── UNMET PEER DEPENDENCY @angular/[email protected]
└── [email protected] 

then I tried to resolve this with installing rxjs and angluar/cli globally. But it didn't work. How do I fix this?

there is a warning : npm WARN [email protected] requires a peer of @angular/core@^4.0.0 but none was installed.

Upvotes: 2

Views: 1333

Answers (2)

Dũng IT
Dũng IT

Reputation: 2999

You try import by:

import {FlashMessagesModule} from 'angular2-flash-messages/module';

constructor(
....
public flashMessage:FlashMessagesService
) { }

logout() {
    ...
    this.flashMessage.show('Your message', {cssClass: 'alert-success', timeout: 3000});
}

This working for me.

Upvotes: 0

eko
eko

Reputation: 40657

It means that that version of angular2-flash-messages uses @angular/core version 4.0.0^. Your project might still work but that's the recommended version. If there are any breaking changes in the peer library your app might crash so it's recommended to install the correct peer dependencies.

Upvotes: 2

Related Questions