PostCSS a not plugin 打包is jenkins打包发布问题跟踪 Error: [object Object] is not a PostCSS plugin

之前在develop平台上 一个前台项目全自动构建都正常,昨天构建失败了,报错信息如下:

ERROR  Failed to compile with 191 errors3:44:52 PM

 error  in assets/css/9366.2f688e5b.css

assets/css/9366.2f688e5b.css from Css Minimizer plugin
Error: PostCSS plugin postcss-discard-comments requires PostCSS 8.
Migration guide for end-users:
https://github.com/postcss/postcss/wiki/PostCSS-8-for-end-users
    at Processor.normalize (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/postcss/lib/processor.js:167:15)
    at new Processor (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/postcss/lib/processor.js:56:25)
    at postcss (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/postcss/lib/postcss.js:55:10)
    at cssnanoPlugin (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/cssnano/src/index.js:167:10)
    at cssnanoMinify (eval at transform (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/css-minimizer-webpack-plugin/dist/minify.:95:33)
    at minify (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/css-minimizer-webpack-plugin/dist/minify.js:37:32)
    at Object.transform (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/css-minimizer-webpack-plugin/dist/minify.js:80:10)
    at execFunction (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/jest-worker/build/workers/threadChild.js:148:17)
    at execHelper (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/jest-worker/build/workers/threadChild.js:127:5)
    at execMethod (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/jest-worker/build/workers/threadChild.js:131:5)

 error  in assets/css/9235.452faa73.css

assets/css/9235.452faa73.css from Css Minimizer plugin
Error: PostCSS plugin postcss-discard-comments requires PostCSS 8.
Migration guide for end-users:
https://github.com/postcss/postcss/wiki/PostCSS-8-for-end-users
    at Processor.normalize (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/postcss/lib/processor.js:167:15)
    at new Processor (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/postcss/lib/processor.js:56:25)
    at postcss (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/postcss/lib/postcss.js:55:10)
    at cssnanoPlugin (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/cssnano/src/index.js:167:10)
    at cssnanoMinify (eval at transform (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/css-minimizer-webpack-plugin/dist/minify.:95:33)
    at minify (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/css-minimizer-webpack-plugin/dist/minify.js:37:32)
    at Object.transform (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/css-minimizer-webpack-plugin/dist/minify.js:80:10)
    at execFunction (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/jest-worker/build/workers/threadChild.js:148:17)
    at execHelper (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/jest-worker/build/workers/threadChild.js:127:5)
    at execMethod (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/jest-worker/build/workers/threadChild.js:131:5)

 error  in assets/css/6217.189cc17b.css

assets/css/6217.189cc17b.css from Css Minimizer plugin
Error: PostCSS plugin postcss-discard-comments requires PostCSS 8.
Migration guide for end-users:
https://github.com/postcss/postcss/wiki/PostCSS-8-for-end-users
    at Processor.normalize (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/postcss/lib/processor.js:167:15)
    at new Processor (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/postcss/lib/processor.js:56:25)
    at postcss (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/postcss/lib/postcss.js:55:10)
    at cssnanoPlugin (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/cssnano/src/index.js:167:10)
    at cssnanoMinify (eval at transform (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/css-minimizer-webpack-plugin/dist/minify.:95:33)
    at minify (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/css-minimizer-webpack-plugin/dist/minify.js:37:32)
    at Object.transform (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/css-minimizer-webpack-plugin/dist/minify.js:80:10)
    at execFunction (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/jest-worker/build/workers/threadChild.js:148:17)
    at execHelper (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/jest-worker/build/workers/threadChild.js:127:5)
    at execMethod (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/jest-worker/build/workers/threadChild.js:131:5)

 error  in assets/css/1221.ecae56e6.css

assets/css/1221.ecae56e6.css from Css Minimizer plugin
Error: PostCSS plugin postcss-discard-comments requires PostCSS 8.
Migration guide for end-users:
https://github.com/postcss/postcss/wiki/PostCSS-8-for-end-users
    at Processor.normalize (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/postcss/lib/processor.js:167:15)
    at new Processor (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/postcss/lib/processor.js:56:25)
    at postcss (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/postcss/lib/postcss.js:55:10)
    at cssnanoPlugin (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/cssnano/src/index.js:167:10)
    at cssnanoMinify (eval at transform (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/css-minimizer-webpack-plugin/dist/minify.:95:33)
    at minify (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/css-minimizer-webpack-plugin/dist/minify.js:37:32)
    at Object.transform (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/css-minimizer-webpack-plugin/dist/minify.js:80:10)
    at execFunction (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/jest-worker/build/workers/threadChild.js:148:17)
    at execHelper (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/jest-worker/build/workers/threadChild.js:127:5)
    at execMethod (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/jest-worker/build/workers/threadChild.js:131:5)

 error  in assets/css/app.e4d210f2.css

assets/css/app.e4d210f2.css from Css Minimizer plugin
Error: PostCSS plugin postcss-discard-comments requires PostCSS 8.
Migration guide for end-users:
https://github.com/postcss/postcss/wiki/PostCSS-8-for-end-users
    at Processor.normalize (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/postcss/lib/processor.js:167:15)
    at new Processor (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/postcss/lib/processor.js:56:25)
    at postcss (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/postcss/lib/postcss.js:55:10)
    at cssnanoPlugin (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/cssnano/src/index.js:167:10)
    at cssnanoMinify (eval at transform (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/css-minimizer-webpack-plugin/dist/minify.:95:33)
    at minify (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/css-minimizer-webpack-plugin/dist/minify.js:37:32)
    at Object.transform (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/css-minimizer-webpack-plugin/dist/minify.js:80:10)
    at execFunction (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/jest-worker/build/workers/threadChild.js:148:17)
    at execHelper (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/jest-worker/build/workers/threadChild.js:127:5)
    at execMethod (/home/jenkins/agent/workspace/sasacweb/sasacweb1/node_modules/jest-worker/build/workers/threadChild.js:131:5)

一直没有找到是什么情况导致这个报错,今天看到这个报错前面有一段warn信息:

npm WARN css-declaration-sorter@6.3.0 requires a peer of postcss@^8.0.9 but none is installed. You must install peer dependencies yourself.
npm WARN cssnano@5.1.12 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies yourself.
npm WARN cssnano-preset-default@5.2.12 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies yourself.
npm WARN cssnano-utils@3.1.0 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies yourself.
npm WARN icss-utils@5.1.0 requires a peer of postcss@^8.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-calc@8.2.4 requires a peer of postcss@^8.2.2 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-colormin@5.3.0 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-convert-values@5.1.2 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-discard-comments@5.1.2 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-discard-duplicates@5.1.0 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-discard-empty@5.1.1 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-discard-overridden@5.1.0 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-merge-longhand@5.1.6 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-merge-rules@5.1.2 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-minify-font-values@5.1.0 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-minify-gradients@5.1.1 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-minify-params@5.1.3 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-minify-selectors@5.2.1 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-modules-extract-imports@3.0.0 requires a peer of postcss@^8.1.0 but none is installed. You must install peer dependencies 
npm WARN postcss-modules-local-by-default@4.0.0 requires a peer of postcss@^8.1.0 but none is installed. You must install peer dependencies 
npm WARN postcss-modules-scope@3.0.0 requires a peer of postcss@^8.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-modules-values@4.0.0 requires a peer of postcss@^8.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-normalize-charset@5.1.0 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-normalize-display-values@5.1.0 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies 
npm WARN postcss-normalize-positions@5.1.1 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-normalize-repeat-style@5.1.1 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies 
npm WARN postcss-normalize-string@5.1.0 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-normalize-timing-functions@5.1.0 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies 
npm WARN postcss-normalize-unicode@5.1.0 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-normalize-url@5.1.0 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-normalize-whitespace@5.1.1 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-ordered-values@5.1.3 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-reduce-initial@5.1.0 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-reduce-transforms@5.1.0 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-svgo@5.1.0 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies yourself.
npm WARN postcss-unique-selectors@5.1.1 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies yourself.
npm WARN stylehacks@5.1.0 requires a peer of postcss@^8.2.15 but none is installed. You must install peer dependencies yourself.

于是在构建命令中增加了安装8.2.2版本(报错的最高版本)的postcss的脚本,完整构建命令如下:

npm install postcss@8.2.2

然后提交package.json到git
最后点develop平台的启动按钮
就自动拉前端代码安装依赖打包成功

这个突然postcss报错的原因通过这个方式解决了,但是为什么会出现这个报错的原因还没查明,我猜测是否构建其他项目更改了postcss版本导致的

  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值