"TypeError: Cannot read property 'on' of undefined"
See original GitHub issueI made a very simple project where I wanted to test vue-konva I get the following:
Error in mounted hook: "TypeError: Cannot read property 'on' of undefined"
My component has a very simple template:
<template>
<v-stage :config="configKonva">
<v-layer>
<v-circle :config="configCircle"></v-circle>
</v-layer>
</v-stage>
</template>
and data:
data () {
return {
configKonva: {
width: 200,
height: 200,
},
configCircle: {
x: 100,
y: 100,
radius: 70,
fill: 'red',
stroke: 'black',
strokeWidth: 4,
},
icons: {},
}
},
the google chrome trace looks like that:
TypeError: Cannot read property 'on' of undefined
at VueComponent.mounted (admin.js:84063)
at callHook (admin.js:90305)
at Object.insert (admin.js:91542)
at invokeInsertHook (admin.js:93344)
at Vue.patch [as __patch__] (admin.js:93563)
at Vue._update (admin.js:90044)
at Vue.updateComponent (admin.js:90172)
at Watcher.get (admin.js:90526)
at new Watcher (admin.js:90515)
at mountComponent (admin.js:90179)
admin being the name of my app.
Any idea where does the problem comes from? It looks almost as some vue-konva components would not be correctly registered, but it that case, I would get a different error message from Vue.
I imported vue-konva with import
and Vue.use(VueKonva)
…
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (2 by maintainers)
Top Results From Across the Web
Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError: Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >[SOLVED] Cannot Read Property of Undefined in JavaScript
The “cannot read property of undefined” error occurs when you attempt to access a property or method of a variable that is undefined...
Read more >Uncaught TypeError: Cannot read property of undefined In
JavaScript TypeError is thrown when an operand or argument passed to a function is incompatible with the type expected by that operator or...
Read more >Node.js Cannot read property 'on' of undefined - Stack Overflow
TypeError : Cannot read property 'on' of undefined at Object.<anonymous> (E:\Project\node\BasicSocial\server.js:12:2) ...
Read more >How to Avoid the Infamous "Cannot read properties of ... - Bitovi
Interpreting undefined or null as subtypes of all other types can lead to runtime problems. For example, if you try to get the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi,
I have an ElectronJS project and I also ran into this bug. To make it work, I had to add
vue-konva
to mywhiteListedModules
in webpack config file (webpack.renderer.config.js
)I hope it can help you too
@jon-ht 's solution is worked, i put the ‘vue-konva’ and restart my project (close the vscode and restart),and it works.