[FIXED] Unable to install PrimeNg on Angular 12.1.4. npm Error

Issue

I am trying to add PrimeNg to my Project however, I get this strange error, I am not sure how to fix it. Can anyone help me out? The current version of angular installed in my machine is 12.1.4.

205-185-99-116:learngaroo sulavdahal$ npm install primeng --save
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: learngaroo@0.0.0
npm ERR! Found: @angular/common@12.2.0
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"^12.1.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0" from primeng@11.4.5
npm ERR! node_modules/primeng
npm ERR!   primeng@"*" 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/sulavdahal/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/sulavdahal/.npm/_logs/2021-08-10T21_33_04_601Z-debug.log

Solution

Its complaining about peer dependencies. This should work:

npm install primeng --save --force

Answered By – danday74

Answer Checked By – David Goodson (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published