【发布时间】:2018-11-06 10:22:48
【问题描述】:
我刚刚使用 webpack 模板设置了一个 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)
我做错了什么?
【问题讨论】:
-
看起来我在问题上领先你一分钟:stackoverflow.com/questions/50555943/…
-
vue-cli好像有错误,可能降级了
-
我在使用 vue 和 webpack 时遇到了这个问题;我的项目中根本没有使用 vue-cli。它甚至没有安装。