vue webpack 模板缺少解析器 [英] vue webpack template missing parser

查看:34
本文介绍了vue webpack 模板缺少解析器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚使用 webpack 模板设置了一个 vue 项目,如下所示:http://vuejs-templates.github.io/webpack/

I was just setting up a vue project using the webpack template like stated here: http://vuejs-templates.github.io/webpack/

但是在运行 npm run dev 只是为了测试模板是否正常工作后,我收到此错误:

However after running npm run dev just to test that the template is working, I get this error:

Failed to compile with 2 errors                                                                                                                                                                                                                                                           21:49:02
 error  in ./src/App.vue

Module build failed: Error: No parser and no file path given, couldn't infer a parser.
    at normalize (path\node_modules\prettier\index.js:7051:13)
    at formatWithCursor (path\node_modules\prettier\index.js:10370:12)
    at path\node_modules\prettier\index.js:31115:15
    at Object.format (path\node_modules\prettier\index.js:31134:12)
    at Object.module.exports (path\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-server ./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 (path\node_modules\prettier\index.js:7051:13)
    at formatWithCursor (path\node_modules\prettier\index.js:10370:12)
    at path\node_modules\prettier\index.js:31115:15
    at Object.format (path\node_modules\prettier\index.js:31134:12)
    at Object.module.exports (path\node_modules\vue-loader\lib\template-compiler\index.js:80:23)

我做错了什么?

推荐答案

Prettier 导致了这个今天发生的 1.13.0 更新中的回归.降级到以前的版本以修复此错误:

Prettier has caused this regression in their 1.13.0 update which occurred today. Downgrade to the previous version to fix this error:

npm install --save-dev prettier@1.12.0

npm install --save-dev prettier@1.12.0

npm 运行开发

这应该可以解决问题.

这篇关于vue webpack 模板缺少解析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆