0

I am getting the following error message when I try to install 'ngx-toastr'. I am also using Bootstrap to build my website.

ERROR

npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@">=16.0.0-0" from ngx-toastr@17.0.2
npm ERR! node_modules/ngx-toastr
npm ERR!   ngx-toastr@"*" from the root project
Angular CLI: 14.2.11
Node: 16.20.1
Package Manager: npm 8.19.4 
OS: linux x64

Angular: 
... 

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.1402.11 (cli-only)
@angular-devkit/core         14.2.11 (cli-only)
@angular-devkit/schematics   14.2.11 (cli-only)
@schematics/angular          14.2.11 (cli-only)
JSON Derulo
  • 9,780
  • 7
  • 39
  • 56
Vinayak Sutar
  • 305
  • 2
  • 10
  • 1
    There seems to be no error just info of the package versions – Kamran Khatti Jul 24 '23 at 15:49
  • Updated. @KamranKhatti – Vinayak Sutar Jul 24 '23 at 15:51
  • You are trying to install the latest version of ngx-toastr in your project. ngx-toastr v17 is only compatible with Angular >= 16, see the [docs](https://github.com/scttcper/ngx-toastr#dependencies). Apparently, you are using an older version of Angular. You need to install an older version of ngx-toastr. – JSON Derulo Jul 24 '23 at 15:52
  • Does this answer your question? [Unable to resolve dependency tree error when installing npm packages](https://stackoverflow.com/questions/64573177/unable-to-resolve-dependency-tree-error-when-installing-npm-packages) – JSON Derulo Jul 24 '23 at 15:53
  • @VinayakSutar error is self explanatory ngx-toaster version 17 is not compatible with angular v14 either upgrade angular version to v16 or downgrade ngx-toaster to make it functional – Kamran Khatti Jul 24 '23 at 16:05

1 Answers1

1

The error you are encountering indicates that there is a version compatibility issue between ngx-toastr and the version of @angular/common installed in your project.

The version of ngx-toastr you are trying to install (17.0.2) requires @angular/common version >=16.0.0, but your current project has Angular version 14.2.11.

You are trying to install ngx-toastr@17.0.2. Since ngx-toastr version 17 requires Angular version 16 or higher, so install the updated angular version or Look for the version that matches your Angular version or has a peer dependency on @angular/common with a version compatible with your project. For example, if there is a version that requires @angular/common@^14.2.0, you can install it by running:npm install ngx-toastr@^14.2.0

npm install ngx-toastr@^14.2.0

Hope this is useful.