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

文章目录

    • 1、出现的错误:
      • 1、代码展示
      • 2、图片展示问题:
    • 2、 问题解决过程
      • 1、在 package.json文件中
    • 2、main.js中添加一句话
    • 3、下面内容注释掉
    • 参考的博客

1、出现的错误:

1、代码展示

E:\librarycat\admin>npm run serve

> app@0.1.0 serve E:\softwork\Practice_Yg\daiding\librarycat\admin
> vue-cli-service serve

 INFO  Starting development server...
98% after emitting CopyPlugin

 ERROR  Failed to compile with 1 error                                                                                                       下午2:51:47

 error  in ./src/App.vue?vue&type=style&index=0&lang=scss&

Syntax Error: Error: Loading PostCSS Plugin failed: Cannot find module 'autoprefixer'
Require stack:
- E:\softwork\Practice_Yg\daiding\librarycat\admin\noop.js

(@E:\softwork\Practice_Yg\daiding\librarycat\admin\package.json)
    at Array.map ()


 @ ./node_modules/@vue/cli-service/node_modules/vue-style-loader??ref--8-oneOf-1-0!./node_modules/@vue/cli-service/node_modules/css-loader??ref--8-oneOf
-1-1!./node_modules/@vue/cli-service/node_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/@vue/cli-service/node_modules/postcss-loader/
src??ref--8-oneOf-1-2!./node_modules/sass-loader/dist/cjs.js??ref--8-oneOf-1-3!./node_modules/@vue/cli-service/node_modules/cache-loader/dist/cjs.js??re
f--0-0!./node_modules/@vue/cli-service/node_modules/vue-loader/lib??vue-loader-options!./src/App.vue?vue&type=style&index=0&lang=scss& 4:14-563 15:3-20:
5 16:22-571
 @ ./src/App.vue?vue&type=style&index=0&lang=scss&
 @ ./src/App.vue
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://192.168.0.145:8081/sockjs-node (webpack)/hot/dev-server.js ./src/main.js


2、图片展示问题:

Syntax Error: Error: Loading PostCSS Plugin failed: Cannot find module ‘autoprefixer‘_第1张图片
Syntax Error: Error: Loading PostCSS Plugin failed: Cannot find module ‘autoprefixer‘_第2张图片

2、 问题解决过程

1、在 package.json文件中

删掉下面的内容

  "postcss":{
    "plugins":{
      "autoprefixer": {}
    }
  },

Syntax Error: Error: Loading PostCSS Plugin failed: Cannot find module ‘autoprefixer‘_第3张图片

2、main.js中添加一句话

import 'amfe-flexible'

3、下面内容注释掉

Syntax Error: Error: Loading PostCSS Plugin failed: Cannot find module ‘autoprefixer‘_第4张图片
Syntax Error: Error: Loading PostCSS Plugin failed: Cannot find module ‘autoprefixer‘_第5张图片

参考的博客

ERROR: LOADING POSTCSS PLUGIN FAILED: CANNOT FIND MODULE ‘AUTOPREFIXER’

你可能感兴趣的:(Web端+HTML+CSS,vue,vue.js)