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