question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Cannot read property 'toLowerCase' of undefined at emptyNodeAt

See original GitHub issue

Version

2.5.17

Reproduction link

https://jsfiddle.net/rn58agzj/

Steps to reproduce

I trying to use async components on my site based on nuxt. But I think bug is in Vue. I have a component with multiple subcomponents. I try to import this component asynchronously. Then when a use hard page reloading in a browser (chrome, firefox etc.) there is a chance to this issue appear

What is expected?

There are no errors expected

What is actually happening?

There is an error: TypeError: Cannot read property ‘toLowerCase’ of undefined at emptyNodeAt

The error is emitting from this function that part of Virtual DOM patching algorithm:

function emptyNodeAt (elm) {
    return new VNode(nodeOps.tagName(elm).toLowerCase(), {}, [], undefined, elm)
}

I can’t reproduct code via jsFiddle. There is a lot of code. There are some code examples in screenshots https://www.dropbox.com/sh/ucon2v5u5dmcag4/AAD_h9Q7ASHUJWsi0_dRORJla?dl=0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:4
  • Comments:19 (1 by maintainers)

github_iconTop GitHub Comments

18reactions
invisorcommented, Dec 5, 2018

@Justineo I found the way how this bug happens. If you use async components and one of these components or its child has v-if directive at the top div (or other) element in its template, this bug has a chance to occur. So it is not recommended to use v-if directive at the top element in the component’s template

13reactions
francesco-hayescommented, Mar 24, 2020

After days of searching for solutions, I have finally found an answer that has fixed it for my Nuxt project running on version 2.12.0!

@webislife was technically right with the problem being caused by the use of “v-if” in the root of a component or file.

In my project, I had a component imported to the layout and on its tag a “v-if” statement, which was causing the issue. It seems to only occur in SSR or Universal mode, so I just moved my “v-if” statement within the components file under the root.

Anyways, give that a look for anyone currently facing this problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

vue.js - Cannot read property 'toLowerCase' of undefined
It may just be that you are not correctly passing the projects data to the projects array. Firstly vue-resource now uses body not...
Read more >
Cannot read property 'toLowerCase' of undefined' on new ...
Always getting 'TypeError: Cannot read property 'toLowerCase' of undefined' on new projects, don't fully understand why.
Read more >
Cannot read property 'toLowerCase' of undefined-Vue.js
Coding example for the question Javascripts : Cannot read property 'toLowerCase' of undefined-Vue.js.
Read more >
Vue.js – Cannot read property 'toLowerCase' of undefined
I am filtering projects with a computed property like this: ... TypeError: Cannot read property 'toLowerCase' of undefined ...
Read more >
Cannot Read Property 'Tolowercase' Of Undefined - ADocLib
There is an error: TypeError: Cannot read property 'toLowerCase' of undefined at emptyNodeAt. The error is emitting from this function that part of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found