安装命令
npm i less-loader
报错信息
mac@gjr vue_test % npm i less-loader
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: vue_test@0.1.0
npm ERR! Found: webpack@4.46.0
npm ERR! node_modules/webpack
npm ERR! peer webpack@"^4.0.0" from @intervolga/optimize-cssnano-plugin@1.0.6
npm ERR! node_modules/@intervolga/optimize-cssnano-plugin
npm ERR! @intervolga/optimize-cssnano-plugin@"^1.0.5" from @vue/cli-service@4.5.15
npm ERR! node_modules/@vue/cli-service
npm ERR! peer @vue/cli-service@"^3.0.0 || ^4.0.0-0" from @vue/cli-plugin-babel@4.5.15
npm ERR! node_modules/@vue/cli-plugin-babel
npm ERR! dev @vue/cli-plugin-babel@"~4.5.0" from the root project
npm ERR! 4 more (@vue/cli-plugin-eslint, @vue/cli-plugin-router, ...)
npm ERR! peer webpack@"^4.0.0 || ^5.0.0" from @soda/friendly-errors-webpack-plugin@1.8.1
npm ERR! node_modules/@soda/friendly-errors-webpack-plugin
npm ERR! @soda/friendly-errors-webpack-plugin@"^1.7.1" from @vue/cli-service@4.5.15
npm ERR! node_modules/@vue/cli-service
npm ERR! peer @vue/cli-service@"^3.0.0 || ^4.0.0-0" from @vue/cli-plugin-babel@4.5.15
npm ERR! node_modules/@vue/cli-plugin-babel
npm ERR! dev @vue/cli-plugin-babel@"~4.5.0" from the root project
npm ERR! 4 more (@vue/cli-plugin-eslint, @vue/cli-plugin-router, ...)
npm ERR! 19 more (@vue/cli-plugin-babel, @vue/cli-plugin-eslint, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! less-loader@"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: webpack@5.65.0
npm ERR! node_modules/webpack
npm ERR! peer webpack@"^5.0.0" from less-loader@10.2.0
npm ERR! node_modules/less-loader
npm ERR! less-loader@"*" 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 /Users/mac/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mac/.npm/_logs/2021-12-14T05_49_04_639Z-debug.log
原因:
由于脚手架创建Vue项目时,webpack版本是低版本
解决方法
安装低版本的less-loader
npm i less-loader@7
安装成功提示
mac@gjr vue_test % npm i less-loader@7
added 16 packages in 5s
20 packages are looking for funding
run `npm fund` for details
mac@gjr vue_test %
查看版本
查看所有版本
npm view less-loader versions
查看结果
mac@gjr vue_test % npm view less-loader versions
[
'0.1.0', '0.1.1', '0.1.2', '0.1.3', '0.2.0',
'0.2.1', '0.2.2', '0.5.0', '0.5.1', '0.6.0',
'0.6.1', '0.6.2', '0.7.0', '0.7.1', '0.7.2',
'0.7.3', '0.7.4', '0.7.5', '0.7.6', '0.7.7',
'0.7.8', '2.0.0', '2.1.0', '2.2.0', '2.2.1',
'2.2.2', '2.2.3', '3.0.0', '4.0.0', '4.0.1',
'4.0.2', '4.0.3', '4.0.4', '4.0.5', '4.0.6',
'4.1.0', '5.0.0', '6.0.0', '6.1.0', '6.1.1',
'6.1.2', '6.1.3', '6.2.0', '7.0.0', '7.0.1',
'7.0.2', '7.1.0', '7.2.0', '7.2.1', '7.3.0',
'8.0.0', '8.1.0', '8.1.1', '9.0.0', '9.1.0',
'10.0.0', '10.0.1', '10.1.0', '10.2.0'
]
查看最新版本
npm view less-loader version
网友评论