日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 前端技术 > vue >内容正文

vue

Vue项目安装axios报错

發布時間:2023/12/14 vue 26 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Vue项目安装axios报错 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Vue項目安裝axios報錯

    • 現象
    • 解決方法
    • 原因分析

現象

vue-cli搭建完項目,輸入命令npm i axios -S安裝axios時報如下錯誤。

Windows PowerShell 版權所有 (C) Microsoft Corporation。保留所有權利。嘗試新的跨平臺 PowerShell https://aka.ms/pscore6PS D:\code\front\demo-eslint> npm i axios -S npm ERR! code ERESOLVE npm ERR! ERESOLVE could not resolve npm ERR! npm ERR! While resolving: @vue/eslint-config-standard@6.1.0 npm ERR! Found: eslint-plugin-vue@8.7.1 npm ERR! node_modules/eslint-plugin-vue npm ERR! dev eslint-plugin-vue@"^8.0.3" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0 npm ERR! node_modules/@vue/eslint-config-standard npm ERR! dev @vue/eslint-config-standard@"^6.1.0" from the root project npm ERR! npm ERR! Conflicting peer dependency: eslint-plugin-vue@7.20.0 npm ERR! node_modules/eslint-plugin-vue npm ERR! peer eslint-plugin-vue@"^7.0.0" from @vue/eslint-config-standard@6.1.0 npm ERR! node_modules/@vue/eslint-config-standard npm ERR! dev @vue/eslint-config-standard@"^6.1.0" 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\sky\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\sky\AppData\Local\npm-cache\_logs\2022-11-10T06_23_49_274Z-debug-0.log

解決方法

命令更改為npm i axios -S --legacy-peer-deps即可安裝成功。

added 6 packages, and audited 1010 packages in 4s133 packages are looking for fundingrun `npm fund` for detailsfound 0 vulnerabilities

原因分析

部分版本NPM中會默認安裝peerDependencies(同伴依賴,它表示包和包之間的宿主關系)。
在很多情況下,這會導致各個包之間的版本沖突,從而中斷安裝過程。

–legacy-peer-deps目的是繞過peerDependency自動安裝,它告訴 npm忽略項目中引入的各個modules之間的相同modules但不同版本的問題并繼續安裝,保證各個引入的依賴之間對自身所使用的不同版本modules共存。

個人是配置eslint的項目再安裝axios報錯,懷疑是這兩個依賴之間沖突。

總結

以上是生活随笔為你收集整理的Vue项目安装axios报错的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。