Richard Tyson

导航

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

出错提示如下:

 ERROR  Failed to compile with 2 errors                                 15:27:22


 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:7051:13)
    at formatWithCursor (D:\works\node_modules\prettier\index.js:10370:12)
    at D:\works\node_modules\prettier\index.js:31115:15
    at Object.format (D:\works\node_modules\prettier\index.js:31134:12)
    at Object.module.exports (D:\works\node_modules\vue-loader\lib\template-compiler\index.js:80:23)

 @ ./src/App.vue 11:0-354
 @ ./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:7051:13)
    at formatWithCursor (D:\works\node_modules\prettier\index.js:10370:12)
    at D:\works\node_modules\prettier\index.js:31115:15
    at Object.format (D:\works\node_modules\prettier\index.js:31134:12)
    at Object.module.exports (D:\works\node_modules\vue-loader\lib\template-compiler\index.js:80:23)

 @ ./src/components/HelloWorld.vue 11:0-366
 @ ./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.0

 

posted on 2018-05-28 15:37  tyson  阅读(1225)  评论(0编辑  收藏  举报