Vue-loader: Cannot read Property ‘parseComponent’ of undefined

Created on 16 Oct 2020  Â·  6Comments  Â·  Source: vuejs/vue-loader

error message

ERROR in ./src/vue/App.vue
Module Error (from ./node_modules/vue-loader/lib/index.js):

Vue packages version mismatch:

- [email protected] (/Users/stephanie/Desktop/webpack/node_modules/vue/index.js)
- [email protected] (/Users/stephanie/Desktop/webpack/node_modules/vue-template-compiler/package.json)

This may cause things to work incorrectly. Make sure to use the same version for both.
If you are using vue-loader@>=10.0, simply update vue-template-compiler.
If you are using vue-loader@<10.0 or vueify, re-installing vue-loader/vueify should bump vue-template-compiler to the latest.
 @ ./src/main.js 7:0-32 10:7-10

ERROR in ./src/vue/App.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
TypeError: Cannot read property 'parseComponent' of undefined
    at parse (/Users/stephanie/Desktop/webpack/node_modules/@vue/component-compiler-utils/dist/parse.js:15:23)
    at Object.module.exports (/Users/stephanie/Desktop/webpack/node_modules/vue-loader/lib/index.js:67:22)
 @ ./src/main.js 7:0-32 10:7-10

webpack 5.1.0 compiled with 2 errors in 4436 ms


package.json

    "vue-loader": "^15.9.3",
    "vue-template-compiler": "^2.6.12",
    "webpack": "^5.1.0",
    "vue"":"^3.0.0"

webpack.config.js

 const VueLoaderPlugin = require('vue-loader/lib/plugin')
 module:{
           rules:
               { 

                   test: /\.vue$/,
                   loader: 'vue-loader'
                },
        },


 plugins: [
            new VueLoaderPlugin()
  ],

I have update the component 'vue-template-Compiler' to match the vue version.However, the version of the compiler was up to 2.6.12, while the vue version was 3.0.0, not resolve this problem

Most helpful comment

I know this thread is closed but I wanted to share my solution for other people who stumble across this with google.

Using "vue-loader": "^16.0.0-rc.1" seems to make everything run fine. I am using encore-webpack but I believe the solution will work with just normal webpack.

All 6 comments

Hello, thank you for taking time filling this issue!

However, we kindly ask you to use our Issue Helper when creating new issues, in order to ensure every issue provides the necessary information for us to investigate. This explains why your issue has been automatically closed by me (your robot friend!).

I hope to see your helper-created issue very soon!

I know this thread is closed but I wanted to share my solution for other people who stumble across this with google.

Using "vue-loader": "^16.0.0-rc.1" seems to make everything run fine. I am using encore-webpack but I believe the solution will work with just normal webpack.

I resolved the issue.

npm uninstall @vue/component-compiler-utils
npm install --dev @vue/[email protected]

I resolved the issue.

npm uninstall @vue/component-compiler-utils
npm install --dev @vue/[email protected]

@habc0807
did you have installed [email protected] ?

(your robot friend!).

@vue-bot You are no friend.

I know this is closed but hopefully you'll solve it by runnin this command: npm update vue-template-compiler

I worked for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TheVexatious picture TheVexatious  Â·  3Comments

birdgg picture birdgg  Â·  3Comments

chrisvfritz picture chrisvfritz  Â·  4Comments

fuyan-run picture fuyan-run  Â·  3Comments

Makio64 picture Makio64  Â·  4Comments