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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM