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

2023-05-25,,

出错提示如下:

 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.

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

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

下载本文的Word格式文档,以方便收藏与打印。