Module build failed: Error: No parser and no file path given, couldn't infer a parser in nuxtjs Module build failed: Error: No parser and no file path given, couldn't infer a parser in nuxtjs vue.js vue.js

Module build failed: Error: No parser and no file path given, couldn't infer a parser in nuxtjs


UPDATE:I mentioned this in the comment below but for some reason people still refer to the same thing.

Please note that this is a hack... A temporary one at that. But it's meant for people who want to get their work done right now... While waiting for a permanent fix to ship. As you might have guessed... A PR has already been submitted and already been merged. Which means a fix is coming within the next release. In the meantime... This will do. And yes when that release comes in it will override this hack and none of this would seem to have happened. Cheers

Dont even bother to downgrade.Its a minor issue.I gave an explanation and what worked for me here:In a nutshell:Go to: node_modules\vue-loader\lib\template-compiler ...open index.js and look for

// prettify render fn if (!isProduction) { code = prettier.format(code, { semi: false}) }

and change the lines to:

// prettify render fnif (!isProduction) {  code = prettier.format(code, { semi: false, parser: 'babylon' })}

Thats it!


Downgrade prettier package to version 1.12.1 and stick with it:

npm i prettier@1.12.1 --save-dev --save-exact


Here's a sed one-liner that fixes it for now:

sed -i 's/semi: false/semi: false, parser: \"babylon\"/g' node_modules/vue-loader/lib/template-compiler/index.js

And for mac:

sed -i '' 's/semi: false/semi: false, parser: \"babylon\"/g' node_modules/vue-loader/lib/template-compiler/index.js

And as an npm script:

"scripts": {  "postinstall": "sed -i 's/semi: false/semi: false, parser: \"babylon\"/g' node_modules/vue-loader/lib/template-compiler/index.js"}