Fix the upstream dependency conflict installing NPM packages
文章推薦指數: 80 %
To solve it, fix the upstream dependency conflict installing NPM packages error. Method 1. Just use --legacy-peer-deps after npm install . Home Public Questions Tags Users Companies Collectives ExploreCollectives Teams StackOverflowforTeams –Startcollaboratingandsharingorganizationalknowledge. CreateafreeTeam WhyTeams? Teams CreatefreeTeam Collectives™onStackOverflow Findcentralized,trustedcontentandcollaboratearoundthetechnologiesyouusemost. LearnmoreaboutCollectives Teams Q&Aforwork Connectandshareknowledgewithinasinglelocationthatisstructuredandeasytosearch. LearnmoreaboutTeams FixtheupstreamdependencyconflictinstallingNPMpackages AskQuestion Asked 1year,10monthsago Modified 18daysago Viewed 229ktimes 157 35 Iamtryingtonpminstallvue-mapboxmapbox-gl,andI'mgettingadependencytreeerror. I'mrunningNuxt.jsSSRwithVuetifyandhaven'tinstalledanythingrelatedtoMapboxpriortorunningthisinstallandamgettingthiserror. 38errorcodeERESOLVE 39errorERESOLVEunabletoresolvedependencytree 40error 41errorWhileresolving:[1mexample[22m@[1m1.0.0[22m 41errorFound:[1mmapbox-gl[22m@[1m1.13.0[22m[2m[22m 41error[2mnode_modules/mapbox-gl[22m 41error[1mmapbox-gl[22m@"[1m^1.13.0[22m"fromtherootproject 41error 41errorCouldnotresolvedependency: 41error[35mpeer[39m[1mmapbox-gl[22m@"[1m^0.53.0[22m"from[1mvue-mapbox[22m@[1m0.4.1[22m[2m[22m 41error[2mnode_modules/vue-mapbox[22m 41error[1mvue-mapbox[22m@"[1m*[22m"fromtherootproject 41error 41errorFixtheupstreamdependencyconflict,orretry 41errorthiscommandwith--force,or--legacy-peer-deps 41errortoacceptanincorrect(andpotentiallybroken)dependencyresolution. 41error 41errorSee/Users/user/.npm/eresolve-report.txtforafullreport. 42verboseexit1 What'stherightwaytogoaboutfixingthisupstreamdependencyconflict? javascriptnode.jsnpmdependenciesmapbox Share Follow editedAug20at11:14 PeterMortensen 30.5k2121goldbadges102102silverbadges124124bronzebadges askedNov20,2020at19:55 connorcodeconnorcode 1,75122goldbadges66silverbadges1313bronzebadges Addacomment | 15Answers 15 Sortedby: Resettodefault Highestscore(default) Trending(recentvotescountmore) Datemodified(newestfirst) Datecreated(oldestfirst) 203 Itlookslikeit'saproblemwithpeerdependenciesinthelatestversionofnpm(v7)whichisstillabetaversion. Trywithnpminstall--legacy-peer-deps.Fordetailedinformationchecktheblogpostnpmv7Series-BetaRelease!And:SemVer-MajorChangesinnpmv7. Share Follow editedAug20at10:35 PeterMortensen 30.5k2121goldbadges102102silverbadges124124bronzebadges answeredNov24,2020at13:42 SultanMaulanaSultanMaulana 2,06611goldbadge55silverbadges33bronzebadges 2 Whatisthatflag? – Ali.Rashidi Apr12,2021at11:02 15 npm:Whentouse--forceand--legacy-peer-depsmightbehelpful – ggorlen Apr28,2021at1:36 Addacomment | 49 Use--legacy-peer-depsafternpminstall.Forexample,ifyouwanttoinstallRadium,use: npminstall--legacy-peer-deps--saveradium Share Follow editedAug20at10:38 PeterMortensen 30.5k2121goldbadges102102silverbadges124124bronzebadges answeredNov30,2020at10:46 ShivamYadavShivamYadav 50722silverbadges22bronzebadges Addacomment | 36 Therearetwoways: usenpminstall--legacy-peer-depstoinstall,andifthisdoesn'tworkuse theforcemethod.Add--forcenexttonpminstall:npminstall--force Share Follow editedAug20at10:39 PeterMortensen 30.5k2121goldbadges102102silverbadges124124bronzebadges answeredApr6,2021at6:52 hatakekakashihatakekakashi 37733silverbadges33bronzebadges Addacomment | 19 Youcanfollowthesecommands Firsttype: npmconfigsetlegacy-peer-depstrue Thentype: npxcreate-react-appmy-app Share Follow editedAug20at10:59 PeterMortensen 30.5k2121goldbadges102102silverbadges124124bronzebadges answeredApr12at8:02 MdSajedulIslamMdSajedulIslam 19111silverbadge44bronzebadges 1 2 Pleaseexplainyourcommandstoo:( – Damika Jun6at19:25 Addacomment | 13 Untilnpmversion7.19.1,itstillhadthesameissue.Afterupgradingtoversion7.20.3,usecommandnpminstall-gnpm@latestandnpmauditfix.Allpackageswillbefixedwithouterror. Share Follow editedAug20at10:41 PeterMortensen 30.5k2121goldbadges102102silverbadges124124bronzebadges answeredAug4,2021at6:20 StupiCodeStupiCode 13111silverbadge22bronzebadges 2 Formethisanswerworkedthebest(Nodev16.14.0,npmv8.3.1,Angular13.2.4).ButIhadtorunitwiththe--forceflag,likethisnpmauditfix--force.Thanks! – MihaiParaschivescu Feb21at0:45 1 Actuallywhentryingtobuildtheproject,thissolutioncausedotherbuilderrorsrelatedtong2-logger(tnp-core/browser,moreexactly).SoIhadtofallbacktonpminstall--legacy-peer-depswhichactuallymadebuildwork. – MihaiParaschivescu Feb21at1:26 Addacomment | 6 Itriedmultipleways,butnothingwasworkingforme.AtlastItriedthisanditworked: npmconfigsetlegacy-peer-depstrue Runthisintheprojectfolderandthentrytoinstallanypackage.Itmightworkforyouaswell. Share Follow editedAug20at11:00 PeterMortensen 30.5k2121goldbadges102102silverbadges124124bronzebadges answeredApr28at6:35 user15842079user15842079 2 1 ThisworkedformeaswellbutIhavenoideawhatthecommandevenmeanslol. – DorjiTshering Jul31at8:32 settingnpmconfigsetlegacy-peer-depstruebeforenpminstallworkedforme. – LakinduKariyawasam Aug9at9:01 Addacomment | 4 Tosolveit,fixtheupstreamdependencyconflictinstallingNPMpackageserror Method1.Justuse--legacy-peer-depsafternpminstall. Forexample,ifyouwanttoinstallAxios,use npminstall--legacy-peer-deps--saveaxios. Method2.Updatingnpmand'auditfix' npmI-gnpm@latest npmauditfix--force Method3.Using--forcetoinstallpackages npminstallaxios--force Share Follow editedAug20at10:47 PeterMortensen 30.5k2121goldbadges102102silverbadges124124bronzebadges answeredApr10at18:13 confused_confused_ 56566silverbadges99bronzebadges Addacomment | 3 Toresolvenpmdependenciesandconflictswithnpmpackages,usenpm-check-updates. Share Follow editedAug20at10:55 PeterMortensen 30.5k2121goldbadges102102silverbadges124124bronzebadges answeredJun23at8:28 NatiKamusherNatiKamusher 39622silverbadges88bronzebadges 1 2 IDKifthisiswhattheOPwasasking,butitwascertainlywhatIwasthinkingwhenIGoogled:okay,sothereareconflicts.HowdoIresolvethemratherthanworkaroundthemwithacommandlineswitch? – hlongmore Jul12at22:28 Addacomment | 2 Yourdependencymexamplerequiresmmapbox-glv1.13.0andmvue-mapboxrequiresv0.53.0. NPMdoesn'treallyknowwhattodo,soitgivesawarning.Youcanbypasstheerrorsusing--forceor--legacy-peer-deps,butyouareignoringanerror. ProductionOptions: Probablyoneofyourpackagesisoutdated.Upgradingpackagesandfixingupgradeerrorsmightfixthedependencyconflict. Overridingadependencymanuallytoavoidthewarninganderror.Youaresettingtheversiontoaspecificonethatyouknowthatworks.Usuallythenewerversion. Examplesolutionwithoverride.Yourpackage.jsonfilewilllooklikethis: { "name":"my-app", "version":"0.1.0", "private":true, "dependencies":{ "mexample":"^1.2.0", "vue-mapbox":"*" }, "scripts":{ "start":"react-scriptsstart", "build":"react-scriptsbuild", "test":"react-scriptstest", "eject":"react-scriptseject" }, "overrides":{ "mmapbox-gl":"1.13.0" } } Thelastoptionisbypassingusingeither: --legacy-peer-depscompletelyignoresallpeerDependenciesusingthenewestversionwithoutpinningonfilepackage-lock.json --forceforcestheuseofthenewest,pinningalltheversionsonpackage-lock.json Extra:Youshouldn'tuse"*"asaversion,becauseitmightupdatemajorandbreakdependencies. Share Follow editedAug20at10:58 PeterMortensen 30.5k2121goldbadges102102silverbadges124124bronzebadges answeredJul4at23:24 GustavoGarciaGustavoGarcia 81611goldbadge77silverbadges2323bronzebadges Addacomment | 1 deletethepackage-lock.jsonfile modifythepackage.jsonfile,updatingtheversionasindicatedbythepeerdependency runnpminstallornpmudpate Share Follow editedAug20at10:44 PeterMortensen 30.5k2121goldbadges102102silverbadges124124bronzebadges answeredMar12at15:57 MatoeilMatoeil 6,58099goldbadges5151silverbadges7474bronzebadges Addacomment | 1 Alotofupvotesforusing--legacy-peer-deps,butif--forceworks,Iwouldrecommendusingthatsinceitstillpinsmanydependencyversionswhile--legacy-peer-depsignorespeerdependenciesentirely.Seetheexamplebelow: npm:Whentouse--forceand--legacy-peer-deps IstartedgettingthiserroronAzureDevOpsafewdaysago.IinitiallythoughtitwasaglitchontheAzureside,butsinceitcontinued,westartedlookingintoitabitmore. Itturnsouttheagentweareusing,windows-2022,wasupdatedafewdaysago: Updatingreadmefileforwin22version20220607.3(#5713) NodeandNPMnowmatchthelatestNode.jsLTSversion:16.15.1(includesnpm8.11.0) Downloads Youcanviewallagents-includedsoftwareonMicrosoft-hostedagents,Software. AfterreadingonMicrosoftVisualStudioDeveloperCommunity,theyrecommenddowngradingNode.jsusingNode.jsToolInstallertasklikethis: -task:NodeTool@0 inputs: versionSpec:'16.14.2' Node.jsToolInstallertask npminstallfailsinAzureDevOpsHostedAgent However,wedecidedthatwedonotwanttodowngradeNode.js,sothefirststepwasmatchingNode.jslocallywithLTSversion16.15.1andnpm8.11.0. Whenrunningnpmci,wethengotthesameerrorlocally. Wetriednpmci--forceandwethengotthiserror: npmcicanonlyinstallpackageswhenyourpackage.jsonand package-lock.jsonornpm-shrinkwrap.jsonareinsync.Pleaseupdate yourlockfilewithnpminstallbeforecontinuing. npminstallgavethesameerrorevenafternode_moduleswasmanuallyremoved,butnpminstall--forceworked,anditgeneratedanewpackage-lock.jsonfile. npmcistillfailedwiththesameerror,butrunningnpmci--forceworked.WedecidedtoupdateAzureDevOps.ymltoinclude--forceandcheckedinthenewpackage-lock.jsonfile.Afterdoingthis,everythingworkedlikebeforeandwecouldnowupdateourpackagesonebyone. Share Follow editedAug20at11:16 PeterMortensen 30.5k2121goldbadges102102silverbadges124124bronzebadges answeredJun14at8:52 OgglasOgglas 53.1k3131goldbadges291291silverbadges354354bronzebadges Addacomment | 0 Iresolvedthisbyadding steps: -task:NodeTool@0 inputs: versionSpec:'12.x' Share Follow answeredAug12at0:29 Victor.UduakVictor.Uduak 2,57822goldbadges1717silverbadges2222bronzebadges 2 Doesthecodesnippetwork? – PeterMortensen Aug20at11:16 Yesitworks!it'sacommandthatwillspecifiestheversionofnpmyourappisusing. – Victor.Uduak Aug27at20:35 Addacomment | -1 IhavedowngradedmyNode.jsversionto10.23.1.Itworkedfine. Share Follow editedAug20at10:50 PeterMortensen 30.5k2121goldbadges102102silverbadges124124bronzebadges answeredMay8at18:23 yogeshclyogeshcl 7955bronzebadges Addacomment | -1 Iwasstuckonthisissueforlongwhichalsomakeserrorfromothercommandswhichcallsforsomeinstallcommandsthatwasbreaking. Theonlysolutionthatworks(maybesuppressestheerror)is npmconfigsetlegacy-peer-depstrue Thiswillsettheconfigurationoflegacy-peer-depstotrue Share Follow answeredSep2at2:29 gilzonmegilzonme 933bronzebadges Addacomment | -1 Thisworksforsure: npmconfigsetlegacy-peer-depstrue Runittheninstallanythingwithnpm. Share Follow editedSep9at5:33 OlegBarabanov 2,33711goldbadge55silverbadges1616bronzebadges answeredSep5at8:19 RioRio 922bronzebadges Addacomment | YourAnswer ThanksforcontributingananswertoStackOverflow!Pleasebesuretoanswerthequestion.Providedetailsandshareyourresearch!Butavoid…Askingforhelp,clarification,orrespondingtootheranswers.Makingstatementsbasedonopinion;backthemupwithreferencesorpersonalexperience.Tolearnmore,seeourtipsonwritinggreatanswers. Draftsaved Draftdiscarded Signuporlogin SignupusingGoogle SignupusingFacebook SignupusingEmailandPassword Submit Postasaguest Name Email Required,butnevershown PostYourAnswer Discard Byclicking“PostYourAnswer”,youagreetoourtermsofservice,privacypolicyandcookiepolicy Nottheansweryou'relookingfor?Browseotherquestionstaggedjavascriptnode.jsnpmdependenciesmapboxoraskyourownquestion. TheOverflowBlog Ethereumfinallymerges,semiconductorsstayscarce(Ep.490) StackOverflowtrends:Weekdayvsweekendsiteactivity FeaturedonMeta RecentColorContrastChangesandAccessibilityUpdates Revieweroverboard!Orarequesttoimprovetheonboardingguidancefornew... CollectivesUpdate:RecognizedMembers,Articles,andGitLab ShouldIexplainotherpeople'scode-onlyanswers? Linked 3 HowcanresolvethissituationErrorERESOLVEcouldnotresolve 1 iamhavinganerrorwhiletryingtoinstallreact-typicalusingnpm -3 erorrforinstallsomelibraryorpakageinnextjs -1 BuildFailedCommand"npminstall"exitedwith1 -1 whileinstallingnextfollowingerroroccur 0 HowtoresolvethesetupoftheTailwindCSSwithNext.jsinVisualStudioCode -1 ProbleminInstallingMaterialuiwithnextjs(withandwithouttypescript)error 137 npm:Whentouse`--force`and`--legacy-peer-deps` 3 Unabletoupgradefromangular12toangular13 2 nvmnotinstalledonGithubAction Seemorelinkedquestions Related 1360 Wheredoesnpminstallpackages? 2791 Findtheversionofaninstallednpmpackage 2464 Howtoupdateeachdependencyinpackage.jsontothelatestversion? 1442 Howtofixnpmthrowingerrorwithoutsudo 906 Howtolistnpmuser-installedpackages 1873 WhatisthedifferencebetweenBowerandnpm? 2668 What'sthedifferencebetweendependencies,devDependenciesandpeerDependenciesinnpmpackage.jsonfile? 2836 Whatisthe--saveoptionfornpminstall? 2214 DoIcommitthepackage-lock.jsonfilecreatedbynpm5? 1 Fixtheupstreamdependencyconflictwhileinstallingng-bootstrap/ng-bootstrap HotNetworkQuestions What'stheusecaseofdisablinganindex? Whydoes"graphic"meanviolentorgory? Isthereanythingillegalaboutworkingforanotherpartywhileonpaidleavefromone'sjob? Extractdatafromagivennestedtable HowdoIsolvethissudokuwithoutguessing Alchemist'sFireandBurnit!Criticaldamage Isthereawaytopreservethethicknessofa(poly)curve? Itcomprisesthatwhichcomposesit Lookingforasciencefictionshortstoryaboutaliensharvestingheatfromaprobe HowdoIremovethisverticalspace? What'sthepurposeofusing2Schottkydiodesconnectedinsuchway? ROT13encryptionusingarrayindexing var()isnotequaltosd()^2inR CanIbringfrozenbakedJamaicanPattiesintotheNetherlands? Isnaturalismfalsifiable? Converting24VACto5VDCwithsmalloutputcurrent ReasonstountrustLet'sEncryptcertificates IsD&DBeyondcorrectinshowingmyranger'sattackbonusbeinghigherthanhisDexmod+bonusfromArcheryFightingStyle? Isthereawaytocomputethespectrumeffectofanon-linearfunction? Howtoremovestorageitem(vectordata)automaticallyafteratimeinterval? Howtorenameafilethatcontainsspacesinterminal? Alignequationsintable Alternativestoscatterplotforvisualisationforlargesamples Whycan'tyousay"Adollwasmademebymysister"? morehotquestions Questionfeed SubscribetoRSS Questionfeed TosubscribetothisRSSfeed,copyandpastethisURLintoyourRSSreader. lang-js Yourprivacy Byclicking“Acceptallcookies”,youagreeStackExchangecanstorecookiesonyourdeviceanddiscloseinformationinaccordancewithourCookiePolicy. Acceptallcookies Customizesettings
延伸文章資訊
- 1Fix the upstream dependency conflict installing NPM packages
Fix the upstream dependency conflict installing NPM packages. Trying to npm install vue-mapbox ma...
- 2Fix the upstream dependency conflict installing NPM packages
Fix the upstream dependency conflict installing NPM packages. Trying to npm install vue-mapbox ma...
- 3Fix “the upstream dependency conflict installing NPM packages”
This article will help you figure out how to solve the "the upstream dependency conflict installi...
- 4npm install报错Fix the upstream dependency conflict, or ...
报错如下:. Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --le...
- 5解决NPM 安装应用出现ERESOLVE 错误- Alan's Blog
Fix the upstream dependency conflict, or retry npm ERR! this command with --force, or --legacy-pe...