Error PostCSS plugin autoprefixer requires PostCSS 8

文章目录

在启动 vue项目时,突然控制台报错: Error: PostCSS plugin autoprefixer requires PostCSS 8。然后依次出现下面几种情况,依次解决完,项目就可以正常启动了

一、情况一

复制代码
error  in ./src/style/common.less

Error: PostCSS plugin autoprefixer requires PostCSS 8.
Migration guide for end-users:
https://github.com/postcss/postcss/wiki/PostCSS-8-for-end-users

 @ ./src/main.js 15:0-30

- 项目 运行中  ERROR  Build failed with errors.
× 项目 运行失败!
失败原因:Error: Command failed with ENOENT: npm run dev

本人是安装如下依赖,然后重新启动就不会报上面这个错了

复制代码
npm install postcss@latest

二、情况二

情况一解决完之后,重新启动项目,又报下面这个错误,醉了<@_@>

复制代码
error  in ./src/style/font.css

Error: PostCSS plugin autoprefixer requires PostCSS 8.
Migration guide for end-users:
https://github.com/postcss/postcss/wiki/PostCSS-8-for-end-users

\ 项目 运行中  ERROR  Build failed with errors.
× 项目 运行失败!
失败原因:Error: Command failed with ENOENT: npm run dev
spawn npm run ENOENT

再次安装如下依赖就完全启动成功了~~~

复制代码
npm i postcss-loader autoprefixer@8.0.0

三、总结

总觉得有些时候npmcnpmyarn各种混用,还有些时候node版本不断切换,也是非常影响稳定性。遇到问题也都是直接把错误贴出去找解决方法,npm也是锁了,所以还是有点烦这种。

相关推荐
Hao_Harrision28 分钟前
50天50个小项目 (React19 + Tailwindcss V4) ✨ | DrawingApp(画板组件)
前端·react.js·typescript·tailwindcss·vite7
dly_blog28 分钟前
Vite 原理与 Vue 项目实践
前端·javascript·vue.js
仅此,44 分钟前
前端接收了id字段,发送给后端就变了
java·前端·javascript·spring·typescript
Lovely Ruby1 小时前
[前端] 封装一下 echart 6,发布到 npm
前端·npm·node.js
BD_Marathon1 小时前
NPM_常见命令
前端·npm·node.js
绿鸳1 小时前
12.17面试题
前端
Huanzhi_Lin1 小时前
禁用谷歌/google/chrome浏览器更新
前端·chrome
咸鱼加辣1 小时前
【前端的crud】DOM 就是前端里的“数据库”
前端·数据库
kong79069281 小时前
环境搭建-运行前端工程(Nginx)
前端·nginx·前端工程
成都证图科技有限公司1 小时前
Bus Hound概述
前端