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 property 'removeListener' of undefined

See original GitHub issue

Since we updated to version 3.3.0 we are getting the following error when we run npm test:

TypeError: Cannot read property 'removeListener' of undefined

at PuppeteerEnvironment.teardown 
(node_modules/jest-environment puppeteer/lib/PuppeteerEnvironment.js:109:22) 
at Generator.throw (<anonymous>)

Our jest.config.js looks like this:

module.exports = {
  testMatch: [
	// our test file regex
  ],
  preset: 'jest-puppeteer'
};

Weirdly enough, we found a very temporary workaround:

  1. remove "preset": "jest-puppeteer" from the config and run the tests -> they fail
  2. put it back in, re-run the tests -> they pass
  3. But: run the tests again -> they fail

The current versions we are using are:

"jest": "^23.5.0",
"jest-puppeteer": "^3.3.0",
"puppeteer": "^1.7.0"

It did work with the following versions:

"jest": "^23.3.0",
"jest-puppeteer": "^3.2.1",
"puppeteer": "^1.6.2"

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
SophieAucommented, Aug 20, 2018

Version 3.3.1 works like a charm. I just hadn’t checked for updates when I created the issue this morning… Sorry!

0reactions
vivek-kandhvarcommented, Feb 8, 2019

Thanks for the reply.

I changed my puppeteer version to 1.11.0 and it started working with 3.7.0. Importance of fixing the version in the package.json file!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to get over Cannot read property 'removeEventListener ...
Cannot read property ' removeEventListener ' of null, is what I get. I read the React 17 docs regarding this, under "potential issues....
Read more >
Cannot read property 'removeEventListener' of undefined
Cannot read property 'removeEventListener' of undefined. Question. Hello. I am working on an enterprise environment and I am building a mobile app.
Read more >
Cannot read property 'removeListener' of undefined · Issue #192
Upon running my tests, I get the error ○ Test suite failed to run TypeError: Cannot read property 'removeListener' of undefined ...
Read more >
Cannot read property 'removeEventListener' of undefined at M
Hi, I have a problem with FileUploadModule, I got this error when open upload-test page. Cannot read property 'removeEventListener' of undefined at ...
Read more >
Next js TypeError: Cannot read properties of null (reading ...
... in my next js app, after joint to the meeting I have an error TypeError: Cannot read properties of null (reading 'removeEventListener')....
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