安装的依赖:
npm add sass sass-loader stylelint postcss postcss-scss postcss-html stylelint-config-prettier stylelint-config-recess-order
stylelint-config-recommended-scss stylelint-config-standard stylelint-config-standard-vue stylelint-scss stylelint-order stylelint-config-standard-scss -D
出现的错误:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: project@0.0.0
npm ERR! Found: stylelint@14.16.1
npm ERR! node_modules/stylelint
npm ERR! dev stylelint@"*" from the root project
npm ERR! peer stylelint@">= 11.x < 15" from stylelint-config-prettier@9.0.5
npm ERR! node_modules/stylelint-config-prettier
npm ERR! dev stylelint-config-prettier@"*" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! dev stylelint-config-recess-order@"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: stylelint@15.9.0
npm ERR! node_modules/stylelint
npm ERR! peer stylelint@">=15" from stylelint-config-recess-order@4.2.0
npm ERR! node_modules/stylelint-config-recess-order
npm ERR! dev stylelint-config-recess-order@"*" 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\ylp\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\ylp\AppData\Local\npm-cache\_logs\2023-06-27T13_49_14_852Z-debug.log
解决方法:
在命令后面加上: --legacy-peer-deps
npm add sass sass-loader stylelint postcss postcss-scss postcss-html stylelint-config-prettier stylelint-config-recess-order
stylelint-config-recommended-scss stylelint-config-standard stylelint-config-standard-vue stylelint-scss stylelint-order stylelint-config-standard-scss -D --legacy-peer-deps