ngx-spinner not installing on Angular 15.0.3

1.5k Views Asked by At

i have angular version 15.0.3. when i trying to install ngx-spinner with command npm install ngx-spinner, I getting an error

  sashamaksyutenko@MacBook-Pro Client % npm install ngx-spinner
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: @angular/[email protected]
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"^15.0.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^14.0.0" from [email protected]
npm ERR! node_modules/ngx-spinner
npm ERR!   ngx-spinner@"*" 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 /Users/sashamaksyutenko/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/sashamaksyutenko/.npm/_logs/2022-12-21T11_40_00_054Z-debug-0.log
sashamaksyutenko@MacBook-Pro Client % 
2

There are 2 best solutions below

1
On

As you can see from the error messages, there are conflicts in upstream dependencies due to version compatibilities. You can still try to install the package by appending one of the suggested commands. If you decide to do so, I would advise you to choose "--legacy-peer-deps" and not "--force". With "--force" you may get strange unexpected results.

npm install ngx-spinner --legacy-peer-deps
1
On

it also gave me the same error, so I uninstalled spinner with the command npm uninstall ngx-spinner and forced to install it again as follows npm install ngx-spinner --force

Hope this can help you.