Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

vue.js - vue webpack template missing parser

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

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
ode_modulesprettierindex.js:7051:13)
    at formatWithCursor (path
ode_modulesprettierindex.js:10370:12)
    at path
ode_modulesprettierindex.js:31115:15
    at Object.format (path
ode_modulesprettierindex.js:31134:12)
    at Object.module.exports (path
ode_modulesvue-loaderlibemplate-compilerindex.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
ode_modulesprettierindex.js:7051:13)
    at formatWithCursor (path
ode_modulesprettierindex.js:10370:12)
    at path
ode_modulesprettierindex.js:31115:15
    at Object.format (path
ode_modulesprettierindex.js:31134:12)
    at Object.module.exports (path
ode_modulesvue-loaderlibemplate-compilerindex.js:80:23)

What am I doing wrong?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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 [email protected]

npm run dev

That should do the trick.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...