Fixing “[vue-loader] vue-template-compiler must be installed as a peer dependency”

Whilst attempting to upgrade an old Laravel project, I hit the following error.

Module build failed (from ./node_modules/vue-loader/lib/index.js):
Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.

After some searching of GitHub and stackoverflow, it turns out that The vue and vue-template-compiler module version must be the same. Here was my existing package.json:

    "private": true,
    "scripts": {
    "devDependencies": {
        "vue": "^2.5.17",
        "vue-loader": "^15.5.1",
        "vue-template-compiler": "^2.5.21"
    "dependencies": {

I changed the vue version to 2.5.21, then ran npm update to update the base version of VueJS.

To check which version of a module is installed run: npm show [module-name] version and the version number will be echoed:

$ npm show vue-template-compiler version

To install a specific version of a module, you can run npm install [module-name]@[version] --save-dev i.e:

$ npm install vue-template-compiler@2.5.21 --save-dev

Any questions?
Please leave a comment with any questions or corrections.

Was this useful, please let me know with one click: Nope, not helpful...Yep, more useful than not! - +5 thumb, 9 overall.

2 thoughts on “Fixing “[vue-loader] vue-template-compiler must be installed as a peer dependency””

  1. In my case I installed vue-template-compiler manually but that still didn’t fix it, then I updated vue (npm install vue) and rebuilt the dependencies (npm rebuild) and then I was finally able to compile.

Leave a Reply

Your email address will not be published. Required fields are marked *