import { FlashMessagesModule } from 'angular2-flash-messages'

Viewed 163

I'm just learning. I ran into this problem when I installed the Angular 2 flash messages module in my project. The installation was not successful.

npm i angular2-flash-messages

npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: front-end@0.0.0 npm ERR! Found: @angular/core@14.0.0 npm ERR! node_modules/@angular/core npm ERR! @angular/core@"^14.0.0" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer @angular/core@"^6.0.0" from angular2-flash-messages@3.0.1 npm ERR! node_modules/angular2-flash-messages npm ERR!
angular2-flash-messages@"*" from the root project npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-peer-deps npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR! npm ERR! See C:\Users\Никита\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:

Who faced this. please tell me.

2 Answers

Seems like a versioning problem. angular2-flash-messages is still using Angular-Core 6.0.0 and you are using Angular-core 14 going on the error message.

Probably there are a few breaking changes between these versions.

I checked angular2-flash-messages and they did not publish a new package for over 4 years, so my advise would be to pick some other package that does the same.

You could also downgrade your Angular, you could try version 12, 8 (before Ivy), or 6, but I would not advise this because then you are stuck on that version only for this package.

Yet another option is to update the package to a newer version yourself: https://github.com/moff/angular2-flash-messages

I have just solved this problem today. The problem occured when using angular 12 with "@angular/fire": "7.2.1", and "firebase": "9.6.7"

The problems solved when I did this:

  1. go to package.json, I added ^ (carret) to these packages: "@angular/fire": "^7.2.1" and "firebase": "^9.6.7"
  2. then I deleted node_modules folder entirely
  3. run: npm install
  4. the problem solved

note: Why I added ^ ? Because, I saw the warning, the red line was occured in those particular packages, so I guess something in those packages and voile. It worked.

Related