Unable to resolve dependency tree error in Angular while ...
文章推薦指數: 80 %
To fix Unable to resolve dependency tree error in Angular while installing `npm` packages follow the below steps. 1. AngularWiki FlexLayoutAngularlCLIMaterialDesignPipesHttpClientFontAwesomeAngularJobs UnabletoresolvedependencytreeerrorinAngularwhileinstallingnpmpackagesFixingUnabletoresolvedependencytreeerrorinAngularArunkumarGudelliLastupdatedon Aug17,2022 3minreadTofixUnabletoresolvedependencytreeerrorinAngularwhileinstallingnpmpackagesfollowthebelowsteps.Runnpminstall--save--legacy-peer-depsinsteadofnpminstallcommand.Anotherwayisdeletenode_modulesfolderandpackage_lock.jsonfileandthenrun npmcacheclean--forceafternpmi--forcecommand.TableofContentsSetthe--legacy-peer-depsflagtoalwaystrueDowngradingnpmversionWhatisUnabletoresolvedependencytreeerror?It’sadependencyconflict(incorrectandpotentiallybrokendependency)error,sorunthecommandwith--forceor--legacy-peer-depsflag.npminstall--save--legacy-peer-deps or npmcacheclean--force npmi--force AnothertemporarysolutionisusingpriorversionsoftheNode.jsordowngradingnpm.Setthe--legacy-peer-depsflagtoalwaystrueAndinsteadofpassing--legacy-peer-depsflageachtimewecansetthenpmconfigtotrue.npmconfigsetlegacy-peer-depstrue Thencleanthecacheandrunnpminstallnpmcacheclean--force npminstall Thisthebestoptionifnpminstallisrunindirectly,i.e,byascript.DowngradingnpmversionWhenusingnpm7,Unabletoresolvedependencytreeerrorscomesupalotbecausepeerdependenciesissuesaretreatedaserrorsinversion7.Buttheseerrorsareonlywarningsinversion6.Sotoresolvethiserrorset--legacy-peer-depsflagtotrueinnpm7version.Iftheaboveconfigisnotworking,downgradenpm7tonpm6.DowngradingNode.jsisnotnecessary.Becausetherelevantdependencymanagementcodeisinnpm.DowngradingNode.jswilloftenworkautomatically,becausedoingsowilldowngradenpmaswell.Insteadofdowngradingnpm,usenpxtousethepreviousversionofnpmforjusttheinstallcommandasshownbelow.npx-pnpm@6npminstall WhatisUnabletoresolvedependencytreeerror?HereisthesampleunabletoresolvedependencytreeerrorinAngular.npmERR!ERESOLVEunabletoresolvedependencytree npmERR! npmERR!Whileresolving:[email protected] npmERR!Found:@angular/[email protected] npmERR!node_modules/@angular/common npmERR!@angular/common@"11.0.3"fromtherootproject npmERR! npmERR!Couldnotresolvedependency: npmERR!peer@angular/common@"^9.1.0||^10.0.0"from@agm/[email protected] npmERR!node_modules/@agm/core npmERR!@agm/core@"3.0.0-beta.0"fromtherootproject Firstwewillunderstandtheproblem.Intheaboveerror@agm/[email protected]@angular/commonversion^9.1.0or^10.0.0.Andtheactual@angular/commonversion11.0.3.Theproblemisaboutpeerdependencies.SoThesolutionistodowngrade@angular/common.Andthat’snotadvisable.Souselegacydependencieslogicforinstallingpackagesusing--legacy-peer-deps.Andtoinstalllegacypeerdependenciesautomaticallysetthenpmconfig--legacy-peer-depstotrue.npmconfigsetlegacy-peer-depstrue ⭐PleasestarAngularWikionGitHub!↗Likedthispost?SubscribeLet'sgoArunkumarGudelliIamOneamongamillionSoftwareengineersofIndia.Iwritebeautifulmarkup.ImaketheWebuseful.NextHowtodetect@inputvaluechangesinAngularChildComponent?PreviousHowToalignmat-dialog-actionsbuttonstotheright,centerorleft
延伸文章資訊
- 1npm 安裝依賴報錯npm ERR! ERESOLVE unable to ... - 有解無憂
ERESOLVE unable to resolve dependency tree. 2021-05-03 08:06:02 區塊鏈. PS F:\devops_common\cloud-vu...
- 2"unable to resolve dependency tree" during install - Lightrun
"unable to resolve dependency tree" during install. (Original URL). When I try to install this pr...
- 3[Solved] ERESOLVE Unable to resolve dependency tree error ...
To Solve ERESOLVE Unable to resolve dependency tree error when installing npm packages You have d...
- 4NPM install error in dependency tree - Lightrun
ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! While resolving: [email protected] npm ER...
- 5Unable to resolve dependency tree error when installing npm ...
You have dependency conflict (incorrect and potentially broken dependency) as it says, so try to ...