vue-cli 报Module build failed: Error: No parser and no file path given, couldn't infer a parser.错的解决方法

出错提示如下:

 ERROR  Failed to compile with  errors                                 ::

 error  in ./src/App.vue

Module build failed: Error: No parser and no file path given, couldn't infer a p
arser.
at normalize (D:\works\node_modules\prettier\index.js::)
at formatWithCursor (D:\works\node_modules\prettier\index.js::)
at D:\works\node_modules\prettier\index.js::
at Object.format (D:\works\node_modules\prettier\index.js::)
at Object.module.exports (D:\works\node_modules\vue-loader\lib\template-compiler\index.js::) @ ./src/App.vue :-
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-serve
r ./src/main.js error in ./src/components/HelloWorld.vue Module build failed: Error: No parser and no file path given, couldn't infer a parser.
at normalize (D:\works\node_modules\prettier\index.js::)
at formatWithCursor (D:\works\node_modules\prettier\index.js::)
at D:\works\node_modules\prettier\index.js::
at Object.format (D:\works\node_modules\prettier\index.js::)
at Object.module.exports (D:\works\node_modules\vue-loader\lib\template-compiler\index.js::) @ ./src/components/HelloWorld.vue :-
@ ./src/router/index.js
@ ./src/main.js
@ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-serve
r ./src/main.js

解决方法是安装prettier

npm i prettier@~1.12.
上一篇:高级I/O之记录锁


下一篇:***文件上传控件bootstrap-fileinput的使用和参数配置说明