在vue3安装stylelint和stylelint-config-prettier和stylelint-config-recess-order出现的版本问题

前言:

项目式vue3+ts+sass,需要安装配置依赖:
npm i 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

然后就出问题了:版本的不兼容,好像stylelint不兼容vue3

问题的描述

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/stylelint
npm ERR!   dev stylelint@"*" from the root project
npm ERR!   peer stylelint@">= 11.x < 15" from [email protected]
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: [email protected]
npm ERR! node_modules/stylelint
npm ERR!   peer stylelint@">=15" from [email protected]
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!

问题的解决:
不能直接安装的时候带–force或者–legacy-peer-deps,但是下次别人获取也会出问题

完美解决

我是降低stylelint为14版本,其他的也都降低版本进行安装就可以啦
	我按照的版本:,具体你们需要什么版本自行试试,目前使用这个没问题,可以正常安装依赖使用
	  "postcss": "^8.4.33",
    "postcss-html": "^1.6.0",
    "postcss-scss": "^4.0.9",
    "prettier": "^2.8.8",
    "sass": "^1.69.7",
    "sass-loader": "^14.0.0",
    "stylelint": "^14.16.1",
    "stylelint-config-prettier": "^9.0.5",
    "stylelint-config-recess-order": "^3.1.0",
    "stylelint-config-recommended-scss": "^8.0.0",
    "stylelint-config-standard": "^28.0.0",
    "stylelint-config-standard-scss": "^6.1.0",
    "stylelint-config-standard-vue": "^1.0.0",
    "stylelint-order": "^6.0.4",
    "stylelint-scss": "^4.7.0",

你可能感兴趣的:(node.js,npm,前端)