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.

Cannot read properties of null (reading 'append') - @cypress/vue

See original GitHub issue

Current behavior

I’ve been unable to run any cypress tests that leverage @cypress/vue package. It always fails with Cannot read properties of null (reading 'append') Related code in node_modules/@cypress/vue/dist/cypress-vue.esm-bundler.js

        var document = cy.state('document');
        var el = document.getElementById(ROOT_ID);
        var componentNode = document.createElement('div');
        el.append(componentNode);

Via: yarn cypress open Screen Shot 2022-03-25 at 10 52 13 AM

Via: yarn cypress run

  1) HelloWorld
       renders a message:
     TypeError: Cannot read properties of null (reading 'append')
      at Context.eval (http://localhost:58195/__cypress/tests?p=cypress/integration/hello-world.spec.js:382:8)

I’ve been banging my head against this error message for days. Am I missing something obvious? Any help is greatly appreciated.

Sample repo provided

Desired behavior

Be able to successfully run the Hellow World cypress test

Test code to reproduce

https://github.com/mmaietta/cypress-test-tiny

yarn install
yarn cypress open

Cypress Version

9.5.2

Other

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

7reactions
Craig1fcommented, Jun 27, 2022

Confirmed this is fixed by modifying the auto-generated component-index..html, line 10 from:

<div data-cy-root></div> to <div data-cy-root id="__cy_root"></div>

1reaction
arielrahmanecommented, Jun 15, 2022

For Vue 2 users: this is solved by using @cypress/vue2

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: Cannot read property 'appendChild' of null
The "Cannot read property 'appendChild' of null" error occurs for 2 reasons: Calling the appendChild() method on a DOM element that doesn't ...
Read more >
TypeError: Cannot read property 'appendChild' of Null in JS
The "Cannot read property 'appendChild' of null" error occurs when trying to call the appendChild method on a DOM element that doesn't exist....
Read more >
Uncaught TypeError: Cannot read property of null - iDiallo
This error occurs when you read a property or call a method on a null object . That's because the DOM API returns...
Read more >
cannot read properties of null (reading 'current') - You.com
I've been unable to run any cypress tests that leverage @cypress/vue package. It always fails with Cannot read properties of null (reading 'append')...
Read more >
Cannot read properties of undefined' - JavaScript Debugging
How To Fix 'Uncaught TypeError: Cannot read properties of ... "Uncaught Typerror: Cannot set properties of null ( reading 'innerHTML')".
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