Create vue project error Error: No parser and no file path given

I"m sorry for the wrong version number, which misled some people. Because today, the codeshelper ios phone uses the sogou input method to edit the problem and switch to English will keep typing. I don"t know what the problem is. I"m really sorry

< hr >

the reason is that
component-compiler-utils 1.3.1 caused by prettier update to 1.13.0 has been updated and fixed.

specific, https://github.com/vuejs/comp.

< hr >

error
in. / src/App.vue

Module build failed: Error: No parser and no file path given, couldn"t infer a parser.

at normalize (F:\WebStormProjects\a9043-blog-mobile\node_modules\prettier\index.js:7051:13)
at formatWithCursor (F:\WebStormProjects\a9043-blog-mobile\node_modules\prettier\index.js:10370:12)
at F:\WebStormProjects\a9043-blog-mobile\node_modules\prettier\index.js:31115:15
at Object.format (F:\WebStormProjects\a9043-blog-mobile\node_modules\prettier\index.js:31134:12)
at Object.module.exports (F:\WebStormProjects\a9043-blog-mobile\node_modules\vue-loader\lib\template-compiler\index.js:80:23)

@. / src/App.vue 11:0
@. / src/main.js
@ multi (webpack)-dev-server/client?

at normalize (F:\WebStormProjects\a9043-blog-mobile\node_modules\prettier\index.js:7051:13)
at formatWithCursor (F:\WebStormProjects\a9043-blog-mobile\node_modules\prettier\index.js:10370:12)
at F:\WebStormProjects\a9043-blog-mobile\node_modules\prettier\index.js:31115:15
at Object.format (F:\WebStormProjects\a9043-blog-mobile\node_modules\prettier\index.js:31134:12)
at Object.module.exports (F:\WebStormProjects\a9043-blog-mobile\node_modules\vue-loader\lib\template-compiler\index.js:80:23)

@. / src/components/HelloWorld.vue 11:0
@. / src/router/index.js
@. / src/main.js
@ multi (webpack)-dev-server/client?
http://localhost:8080 webpack/hot/dev-server. / src/main.js

Mar.14,2021

see: https://github.com/vuejs/comp.

Sorry, because track, is not updated here in github.

question background:

the problem here is that because of prettier, 's dependency on vue-cli, the removal of a feature is released as a minor version. This causes an error in the @ vue/component-compiler-utils runtime of npm install to.

after communicating with the prettier author, prettier has no plans to release a new version to correct this in order to avoid fragmentation, so I sent a PR to component-compiler-utils and provided a workaround to downgrade prettier to the previous version before the PR merge.

author of Evan (vue later in the evening) merged with PR and released a new component-compiler-utils-sharp1.3.1, for vue-loader v15, this problem has been solved. But you need to upgrade component-compiler-utils manually.

< hr >

solution:

if it is vue-loader v15

  

it took almost an hour to solve the problem:
rm-rf node_modules npm install npm install prettier@~1.12.1
my success
if there is a lock and so on, delete it first, and if you honestly use npm, slow down, cnpm test is not good, maybe it hasn't been updated yet?

Menu