我刚刚用网页模板设置了一个vue项目,如这里所述:http://vuejs-templates.github.io/webpack/

然而,在运行npm run dev只是为了测试模板是否正常工作之后,我出现了以下错误:

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更新中导致了这种倒退.降级到上一版本以修复此错误:

npm安装--保存开发prettier@1.12.0

npm运行开发

这应该能奏效.

Vue.js相关问答推荐

VueJS不会呈现一个名为None的组件""

VUE:带自定义组件的数组输入绑定

Vuetify/Vue3 插槽模板之间的阴影

Vuetify 3 v-radio-group 将模型设置为 null

NUXT 3 在客户端获取数据

vuetify/mdi 不显示图标

VueJS3 - 在 for 循环中获取元素的句柄

在 bootstrap-vue 中渲染自定义样式

如何 for each 用户分组聊天消息?

我是否必须在 Vue 3 中使用 Composition API,还是仍然可以使用Vue 2的方式工作?

aspnet core如何在deploy上构建webpack

将检测外部点击自定义指令从 Vue 2 迁移到 Vue 3

使用 vee-validate 在 vue js 中进行验证有错误

如何使表格行可点击并展开行 - vue.js - element-ui

在 Vue.js 中,为什么我们必须在导入组件后导出它们?

JavaScript/VueJS:判断数组是否包含具有特定值元素的对象

如何告诉 Vue 应用使用 Firebase 模拟器?

如何将 Angular 和 Vue 项目合并在一起?

在 VUE JS 的光标位置插入字符

单击 v-select 项目时如何获取对象而不是单个值?