ERROR vue-template-compiler must be installed as a peer dependency

Hello Friends! 🙏, today while I was working on How to setup a Vue JS v3 project from scratch (without Vue CLI) (Including SFC’s & Vue Router v4), When I compiled the App, I got below error ❗.

Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.

As error has already pointed the issue is at vue-loader, I went through the documentation and every thing looked fine.

And after doing lots of research 🔍🔍😁, I found that it is all because we are using Vue v3 which is pretty new and packages related to it are still migrating or have migrated but without documentation it is becoming tough to figure out the things.

So basically for Vue v3, we need to install vue-loader@next instead of vue-loader, it will install version 17 which is compatible with Vue v3 & @vue/compiler-sfc.
After installing the vue-loader@next, issue got resolved. Hope it have helped you too.

Thanks 🙏.

Leave a Comment

Your email address will not be published.