報(bào)錯(cuò)代碼如下:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: webvue@0.1.0
npm ERR! Found: vue@3.2.47
npm ERR! node_modules/vue
npm ERR! vue@"^3.2.13" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue@"^2.5.17" from element-ui@2.15.12
npm ERR! node_modules/element-ui
npm ERR! element-ui@"*" 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 D:\SoftWareLocation\node_js\node_cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! D:\SoftWareLocation\node_js\node_cache\_logs\2023-02-09T11_40_48_239Z-debug-0.log
報(bào)錯(cuò)原因:由于npm版本太高導(dǎo)致此錯(cuò)誤發(fā)。npm的版本只要超大于或等于7.x.x,會(huì)在某些方面上更加嚴(yán)格,就會(huì)導(dǎo)致出現(xiàn)這種情況,低于7.x.x不會(huì)出現(xiàn)這種情況
查看npm版本:npm -v
解決方案
1.在指令后面都添加上 --legacy-peer-deps,如下
npm xxx --legacy-peer-deps
2.在指令后面都加上 --force,如下
npm xxx --force
3.降低npm版本(不推薦,謹(jǐn)慎)文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-704916.html
npm install npm@6.14.12 -g //降低版本指令,版本自己可選擇
因?yàn)榻档桶姹竞螅菀讓?dǎo)致npm和node不相容,會(huì)出現(xiàn)很大的問(wèn)題?。。?span toymoban-style="hidden">文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-704916.html
到了這里,關(guān)于【Vue報(bào)錯(cuò)】npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR!的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!