国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

npm i時報錯npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving

這篇具有很好參考價值的文章主要介紹了npm i時報錯npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點擊"舉報違法"按鈕提交疑問。

項目場景:

使用npm或yarn安裝第三方包。


問題描述

使用npm命令和yarn命令混合使用會出現(xiàn)安裝包沖突。

E:\WorkSpace\react\zhuangao_05\dome_01>npm i echarts echarts-for-react
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @jiaminghi/data-view-react@1.2.5
npm ERR! Found: react@18.2.0
npm ERR! node_modules/react
npm ERR!   peer react@">=16.0.0" from @ant-design/cssinjs@1.3.2
npm ERR!   node_modules/@ant-design/cssinjs
npm ERR!     @ant-design/cssinjs@"^1.3.0" from antd@5.1.2
npm ERR!     node_modules/antd
npm ERR!       antd@"^5.0.4" from the root project
npm ERR!   peer react@">=16.0.0" from @ant-design/icons@4.8.0
npm ERR!   node_modules/@ant-design/icons
npm ERR!     @ant-design/icons@"^4.7.0" from antd@5.1.2
npm ERR!     node_modules/antd
npm ERR!       antd@"^5.0.4" from the root project
npm ERR!     @ant-design/icons@"^4.8.0" from the root project
npm ERR!   53 more (@ant-design/react-slick, @rc-component/portal, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.0" from @jiaminghi/data-view-react@1.2.5
npm ERR! node_modules/@jiaminghi/data-view-react
npm ERR!   @jiaminghi/data-view-react@"^1.2.5" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react@16.14.0
npm ERR! node_modules/react
npm ERR!   peer react@"^16.8.0" from @jiaminghi/data-view-react@1.2.5
npm ERR!   node_modules/@jiaminghi/data-view-react
npm ERR!     @jiaminghi/data-view-react@"^1.2.5" 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 C:\Users\86158\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\86158\AppData\Local\npm-cache\_logs\2023-01-09T06_13_18_485Z-debug-0.log

原因分析:

如果將yarn.lockpackage.lock文件放在一起,有時會變得很困難,因為存在不同步的風(fēng)險
yarn install 安裝生成的 yarn.lock 文件 與 npm install 生成的 package-lock.json 文件時間相差較遠,造成了 yarn.lock 的包版本低于 package-lock.json 的包版本。因為以 ?x.x.x 形式定義的包版本在不同時期安裝包版本不一致。
yarn 安裝 @babel/preset-env 版本有: “7.5.5”, “^7.4.5”,實際安裝的 version 是 “7.5.5”。
npmyarn 安裝包不一致
紗線和npm是可以互換的。只要你每次都使用相同的一個,它們之間就沒有區(qū)別。它們有不同的安裝目錄,這就是它們不能一起使用的原因。Yarn會安裝一個包,npm找不到它。npm會安裝一個包,yarn找不到它


解決方案:

1、npm i xxx --legacy-peer-deps

使用 npm i xxx --legacy-peer-deps,命令來安裝依賴!

為什么?作用?
npm install xxxx --legacy-peer-deps命令與其說是告訴npm要去干什么,不如說是告訴npm不要去干什么。

legacy的意思:遺產(chǎn)/(軟件或硬件)已過時但因使用范圍廣而難以替代的;而npm install xxxx --legacy-peer-deps命令用于繞過peerDependency里依賴的自動安裝;它告訴npm忽略項目中引入的各個依賴模塊之間依賴相同但版本不同的問題,以npm v3-v6的方式去繼續(xù)執(zhí)行安裝操作。

所以其實該命令并沒有真的解決沖突,而是忽略了沖突,以“過時”(v3-v6)的方式進行下載操作。

2、刪除所有關(guān)于npm安裝依賴的文件

刪除之后再重新npm i ,安裝需要的第三方包

為了防止沖突文件,所以使用一致的命令來安裝第三方庫。文章來源地址http://www.zghlxwxcb.cn/news/detail-492251.html

到了這里,關(guān)于npm i時報錯npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實不符,請點擊違法舉報進行投訴反饋,一經(jīng)查實,立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費用

相關(guān)文章

  • npm ERR code ERESOLVE ;npm ERRERESOLVE could not resolve

    安裝 npm 插件時出現(xiàn)錯誤 報錯的原因可能是 : npm 版本問題, npm 的不同版本對不同的組件庫等命令不兼容,對命令的要求更嚴格; 最簡單的解決方法是將 --legacy-peer-deps 標志傳遞給 npm ,解決指令例如:

    2024年02月15日
    瀏覽(91)
  • npm ERR! code ERESOLVEnpm ERR! ERESOLVE could not resolve dependency

    使用命令安裝 npm 包時,我收到這些異常。 如何解決 ERESOLVE 無法解決安裝 npm 包時的依賴關(guān)系樹錯誤 錯誤? 要解決 ERESOLVE 安裝 npm 包時無法解決依賴關(guān)系樹錯誤,您有 依賴關(guān)系沖突 ( 不正確 且可能 損壞 的依賴關(guān)系),如它所說,因此請嘗試使用 或 運行命令。如果它沒有

    2024年02月08日
    瀏覽(91)
  • npm ERR! ERESOLVE could not resolve

    問題產(chǎn)生的原因和如何解決,其實npm已經(jīng)列在了最后: 問題原因是依賴沖突導(dǎo)致不能下載依賴包(dependency conflict), 因為npm版本升級(version7), npmV7之前的版本遇到依賴沖突會忽視依賴沖突,繼續(xù)進行安裝, npmV7版本開始不會自動進行忽略,需要用戶手動輸入命令。 解決

    2024年02月15日
    瀏覽(91)
  • 【報錯】npm ERR! ERESOLVE could not resolve、certificate has expired

    使用npm淘寶鏡像 https://registry.npm.taobao.org 年前創(chuàng)建的vue3項目 npm install 完后沒有使用ui寫了點雜七雜八的東西,年后看到一篇文章有點興趣,掏出來準備試一下,本打算安裝element-plus 寫起來方便點 npm install element-plus --save ,結(jié)果就運行后就報錯 看這一堆眼花繚亂的,其實最有

    2024年02月22日
    瀏覽(84)
  • npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree

    npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree

    當我們拿到一個前端項目的時候,想要把它運行起來,首先是要給它安裝依賴,即cd到當前項目根目錄下去執(zhí)行npm install命令,然后有一定幾率在終端你會遇到這樣的報錯: npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree 用我的中式英語翻譯一下就是:不能解析依賴

    2023年04月12日
    瀏覽(92)
  • code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree解決

    在使用npm install之后,出現(xiàn)“code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree”報錯 所以出現(xiàn)報錯時就猜測有可能是版本過老導(dǎo)致的相關(guān)問題。 而事實上,ERESOLVE相關(guān)的報錯原因大多也確實是npm7與npm6之間的差異所導(dǎo)致的。 當然你也可以選擇降版本到npm6來解決。 網(wǎng)上有人的

    2024年02月06日
    瀏覽(95)
  • 【Vue報錯】npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR!

    報錯代碼如下: 報錯原因:由于npm版本太高導(dǎo)致此錯誤發(fā)。npm的版本只要超大于或等于7.x.x,會在某些方面上更加嚴格,就會導(dǎo)致出現(xiàn)這種情況,低于7.x.x不會出現(xiàn)這種情況 解決方案 1.在指令后面都添加上 --legacy-peer-deps,如下 2.在指令后面都加上 --force,如下 3.降低npm版本(

    2024年02月09日
    瀏覽(78)
  • 【npm】npm install命令報錯npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree

    一、現(xiàn)象: npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree 二、原因 ERESOLVE與npm@7有關(guān)的問題很常見,因為npm7.x對某些事情比npm6.x更嚴格。通常,最簡單的解決方法是將–legacy-peer-deps標志傳遞給npm(e.g.,npm i --legacy-peer-deps),或者使用npm@6。 如果這不能立即起作用,

    2024年02月04日
    瀏覽(99)
  • npm ERR! code ERESOLVEnpm ERR! ERESOLVE unable to resolve dependency tree

    npm ERR! code ERESOLVEnpm ERR! ERESOLVE unable to resolve dependency tree

    拉取項目到本地 執(zhí)行 npm install 報錯 遇到這個問題首先確認的就是版本是不是太高了,降一下版本?;蛘咄ㄟ^yarn命令替代npm install命令安裝,同理,啟動也可以采用yarn dev 啟動代替npm run dev 下面教大家用一個NVM工具,這個工具是用來管理node.js版本的 nvm流程安裝 1、卸載node.

    2024年02月13日
    瀏覽(89)
  • 解決npm install時報錯Could not resolve dependency

    最近在新的項目使用npm install時發(fā)現(xiàn)報錯: npm WARN cli npm v9.6.4 does not support Node.js v15.14.0. This version of npm supports the following node versions: `^14.17.0 || ^16.13.0 || =18.0.0`. You can find the latest version at https://nodejs.org/. npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR!? npm ERR! While resolving:

    2024年02月08日
    瀏覽(25)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包