升级最新就行
- 发布:2022-09-20 14:17
- 更新:2022-11-04 11:52
- 阅读:2318
【报Bug】新版本使用 yarn 升级依赖会有问题 Error: PostCSS plugin postcss-uniapp-plugin requires PostCSS 8.
产品分类: uniapp/H5
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: 最新 win11
浏览器平台: Chrome
浏览器版本: 最新
项目创建方式: CLI
CLI版本号: 2.0.1-36320220917001
操作步骤:
预期结果:
没问题
没问题
实际结果:
有问题
有问题
bug描述:
Module build failed (from ./node_modules/postcss-loader/src/index.js):
14:13:13.629 Error: PostCSS plugin postcss-uniapp-plugin requires PostCSS 8.
14:13:13.636 Migration guide for end-users:
14:13:13.643 https://github.com/postcss/postcss/wiki/PostCSS-8-for-end-users
yann 安装依赖出问题
码字如山 (作者) - 初代 uni-app 开发,出来就在用,uniapp 开发请联系 v: BAqTCwd6qr0Zd5CgoVfk q: 1647800606
devDependencies
"stylelint": "^13.13.1",
"stylelint-config-prettier": "^8.0.2",
"stylelint-config-standard": "^22.0.0",
"stylelint-order": "^4.1.0",
scripts
"lint:stylelint": "stylelint --fix \"src/*/.{vue,less,postcss,css,scss}\" --allow-empty-input --cache --cache-location node_modules/.cache/stylelint/",
stylelint.config.js
module.exports = {
// v13
root: true,
plugins: ['stylelint-order'],
// v13
extends: [
'stylelint-config-standard',
'stylelint-config-prettier',
// 'stylelint-config-standard-scss',
// 'stylelint-config-prettier-scss',
],
// v14
// extends: [
// 'stylelint-config-standard-scss',
// 'stylelint-config-recommended-vue',
// 'stylelint-config-property-sort-order-smacss',
// 'stylelint-config-prettier',
// ],
rules: {
// 'scss/at-import-partial-extension': 'always',
'selector-class-pattern': null,
// uni-ap 特有的 rpx upx 单位
'unit-no-unknown': [
true,
{
ignoreUnits: ['rpx', 'upx'],
},
],
// uni-app nvue 属性
'property-no-unknown': [
true,
{
ignoreProperties: ['lines'],
},
],
// uni-app 特有的选择器
'selector-type-no-unknown': [
true,
{
ignoreTypes: [
'page',
'picker-view',
'uni-scroll-view',
'uni-button',
'scroll-view',
'uni-picker',
'uni-image',
'uni-textarea',
'uni-page-body',
'uni-input',
'uni-slider',
],
},
],
// nvue 至少需要一个 style 标签
'no-empty-source': null,
// nvue 字体设置
'font-family-no-missing-generic-family-keyword': null,
// scss @ 规则
'at-rule-no-unknown': null,
// 这个是不然把类似 “rgba(25, 24, 30, 1)” 格式化成 "rgb(25 24 30 / 100%)" 这种形式 sass 还不支持这种语法
'color-function-notation': null,
// 禁用类似直接使用 unquote 不行 而要改为 string.unquote 这种的错误
// 'scss/no-global-function-names': null,
'selector-pseudo-element-no-unknown': [
true,
{
ignorePseudoElements: ['v-deep'],
},
],
// 'annotation-no-unknown': [
// true,
// {
// ignoreAnnotations: ['default'],
// },
// ],
'value-no-vendor-prefix': [
true,
{
ignoreValues: ['box'],
},
],
},
}
码字如山 (作者)
嗯呐,我用的 "packageManager": "yarn@3.2.3",
2022-10-12 13:46
码字如山 (作者)
yarn 的 v3 版本
2022-10-12 13:46
码字如山 (作者)
"dependencies": {
"@dcloudio/uni-app-plus": "2.0.1-36420220922001",
"@dcloudio/uni-h5": "2.0.1-36420220922001",
"@dcloudio/uni-helper-json": "",
"@dcloudio/uni-i18n": "2.0.1-36420220922001",
"@dcloudio/uni-mp-360": "2.0.1-36420220922001",
"@dcloudio/uni-mp-alipay": "2.0.1-36420220922001",
"@dcloudio/uni-mp-baidu": "2.0.1-36420220922001",
"@dcloudio/uni-mp-jd": "2.0.1-36420220922001",
"@dcloudio/uni-mp-kuaishou": "2.0.1-36420220922001",
"@dcloudio/uni-mp-lark": "2.0.1-36420220922001",
"@dcloudio/uni-mp-qq": "2.0.1-36420220922001",
"@dcloudio/uni-mp-toutiao": "2.0.1-36420220922001",
"@dcloudio/uni-mp-vue": "2.0.1-36420220922001",
"@dcloudio/uni-mp-weixin": "2.0.1-36420220922001",
"@dcloudio/uni-mp-xhs": "2.0.1-36420220922001",
"@dcloudio/uni-quickapp-native": "2.0.1-36420220922001",
"@dcloudio/uni-quickapp-webview": "2.0.1-36420220922001",
"@dcloudio/uni-stacktracey": "2.0.1-36420220922001",
"@dcloudio/uni-stat": "2.0.1-36420220922001",
"@hyoga/uni-socket.io": "1.0.1",
"@vue/shared": "^3.0.0",
"core-js": "^3.6.5",
"dayjs": "^1.11.5",
"echarts": "^5.4.0",
"flyio": "^0.6.2",
"lodash": "^4.17.21",
"number-precision": "^1.5.2",
"regenerator-runtime": "^0.12.1",
"validator": "^13.7.0",
"vue": "^2.6.11",
"vue-i18n": "8",
"vuex": "^3.2.0"
},
"devDependencies": {
"@babel/eslint-parser": "^7.18.9",
"@babel/runtime": "~7.17.9",
"@dcloudio/types": "^3.0.4",
"@dcloudio/uni-automator": "2.0.1-36420220922001",
"@dcloudio/uni-cli-i18n": "2.0.1-36420220922001",
"@dcloudio/uni-cli-shared": "2.0.1-36420220922001",
"@dcloudio/uni-migration": "2.0.1-36420220922001",
"@dcloudio/uni-template-compiler": "2.0.1-36420220922001",
"@dcloudio/vue-cli-plugin-hbuilderx": "2.0.1-36420220922001",
"@dcloudio/vue-cli-plugin-uni": "2.0.1-36420220922001",
"@dcloudio/vue-cli-plugin-uni-optimize": "2.0.1-36420220922001",
"@dcloudio/webpack-uni-mp-loader": "2.0.1-36420220922001",
"@dcloudio/webpack-uni-pages-loader": "2.0.1-36420220922001",
"@vue/cli-plugin-babel": "~4.5.19",
"@vue/cli-service": "~4.5.19",
"@vue/eslint-config-prettier": "^7.0.0",
"babel-loader": "^8.2.5",
"babel-plugin-import": "^1.11.0",
"cross-env": "^7.0.2",
"eslint": "^8.24.0",
"eslint-plugin-html": "^7.1.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-vue": "^9.5.1",
"husky": "^8.0.1",
"jest": "^25.4.0",
"lint-staged": "^13.0.3",
"mini-types": "",
"miniprogram-api-typings": "*",
"postcss-comment": "^2.0.0",
"postcss-html": "^1.5.0",
"postcss-scss": "^4.0.5",
"prettier": "^2.7.1",
"sass": "^1.55.0",
"sass-loader": "8.0.2",
"stylelint": "^14.12.1",
"stylelint-config-prettier": "^9.0.3",
"stylelint-config-property-sort-order-smacss": "^9.0.0",
"stylelint-config-recommended-vue": "^1.4.0",
"stylelint-config-standard-scss": "^5.0.0",
"stylelint-order": "^5.0.0",
"vue-template-compiler": "^2.6.11"
},
"packageManager": "yarn@3.2.3",
"engines": {
"node": ">=14"
},
"uni-app": {
"scripts": {}
}
2022-10-12 13:49
码字如山 (作者)
我锁定版本在 2.0.1-35320220729002 这个版本可以正常编译
2022-10-12 13:49
码字如山 (作者)
能解决吗
2022-10-17 10:10
1***@qq.com
回复 码字如山: 请问解决了吗
2022-10-17 14:07
码字如山 (作者)
回复 1***@qq.com: 还没有,官方问了一下就没下文了,现在用的老版本,没升级到最新版本
2022-10-18 09:56
码字如山 (作者)
回复 1***@qq.com: 降低 stylelint 到 v13
2022-10-18 15:55
码字如山 (作者)
"stylelint": "^13.13.1",
"stylelint-config-prettier": "^8.0.2",
"stylelint-config-standard": "^22.0.0",
"stylelint-order": "^4.1.0",
2022-10-18 15:55