解决Syntax Error: Error: Loading PostCSS Plugin failed: Cannot find module ‘autoprefixer‘

问题

使用npm run serve启动服务

 ERROR  Failed to compile with 2 errors                                                                                                                                                                           16:02:15

 error  in ./node_modules/.store/[email protected]/node_modules/timeline-vuejs/dist/timeline-vuejs.css

Syntax Error: Error: Loading PostCSS Plugin failed: Cannot find module 'autoprefixer'
Require stack:
- D:\code\vscodeProjects\backendweb\noop.js

(@D:\code\vscodeProjects\backendweb\node_modules\.store\[email protected]\node_modules\timeline-vuejs\.postcssrc.js)
    at Array.map (<anonymous>)


 @ ./node_modules/.store/[email protected]/node_modules/timeline-vuejs/dist/timeline-vuejs.css 4:14-222 15:3-20:5 16:22-230
 @ ./src/main.js
 @ multi ./node_modules/.store/[email protected]/node_modules/webpack-dev-server/client?http://172.16.20.82:9527&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js

 error  in ./node_modules/.store/[email protected]/node_modules/element-ui/lib/theme-chalk/radio.css

Syntax Error: Error: Loading PostCSS Plugin failed: Cannot find module 'autoprefixer'
Require stack:
- D:\code\vscodeProjects\backendweb\noop.js

(@D:\code\vscodeProjects\backendweb\package.json)
    at Array.map (<anonymous>)


 @ ./node_modules/.store/[email protected]/node_modules/element-ui/lib/theme-chalk/radio.css 4:14-219 15:3-20:5 16:22-227
 @ ./src/main.js
 @ multi ./node_modules/.store/[email protected]/node_modules/webpack-dev-server/client?http://172.16.20.82:9527&sockPath=/sockjs-node (webpack)/hot/dev-server.js ./src/main.js

Autoprefixer

Autoprefixer是一款自动管理浏览器前缀的插件,它可以解析CSS文件并且添加浏览器前缀到CSS内容里,使用Can I Use(caniuse网站)的数据来决定哪些前缀是需要的。
Autoprefixer是一个后处理程序,不象Sass以及Stylus之类的预处理器。它适用于普通的CSS,可以实现css3代码自动补全。也可以轻松跟SassLESSStylus集成,在CSS编译前或编译后运行。

解决办法

package.json中删除autoprefixer可以运行了
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_44732146/article/details/131684106
今日推荐