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.

Uncaught TypeError: Cannot read property 'close' of undefined

See original GitHub issue

Bug Report

Describe the bug

When i add docz to a create-react-app and start the server, it shows a blank page and it gives me this error.

To Reproduce

  1. npx create-react-app my-app && cd my-app
  2. yarn add docz docz-theme-default --dev
  3. Create a basic mdx file
  4. yarn docz dev
  5. A blank page appears
  6. See this error in console:
Uncaught TypeError: Cannot read property 'close' of undefined
    at Object.eval (index.js?e094:72)
    at eval (index.js:230)
    at Object../node_modules/chalk/index.js (vendors.js:554)
    at __webpack_require__ (runtime~app.js:801)
    at fn (runtime~app.js:164)
    at eval (formatWebpackMessages.js?5b63:10)
    at Object../node_modules/react-dev-utils/formatWebpackMessages.js (vendors.js:6800)
    at __webpack_require__ (runtime~app.js:801)
    at fn (runtime~app.js:164)
    at eval (webpackHotDevClient.js?7ef4:23)

Expected behavior

The app should work

Environment

  • OS: MacOS 10.14.1
  • Node/npm version: Node 10.14.2/npm 6.4.1/Yarn 1.12.3

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:34
  • Comments:31 (10 by maintainers)

github_iconTop GitHub Comments

24reactions
elv1ncommented, Dec 22, 2018

I’ve noticed that the problem appears when using docz with react-scripts and the reason is a different version of ‘ansi-styles’. Currently, you can fix it with addition resolutions to package.json

  "resolutions": {
    "ansi-styles": "^3.2.0"
  }

and run yarn

9reactions
burtyishcommented, Jan 3, 2019

I can confirm that it’s not related to react-scripts. I’m running a non-CRA app and ran into the same issue while setting up docz.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: Cannot read property 'close' of undefined
You have to click Open "myWindow" button before clicking the other one, because that is when the variable myWindow gets initial value.
Read more >
SOLVED: TypeError: Cannot read property 'close' of undefined
Hi Everyone, Hope you are enjoying the course! If anyone is experiencing the below issue like this: TypeError: Cannot read property 'close' ......
Read more >
Uncaught TypeError: Cannot read property 'close' of undefined
When I open the js file, the error is on the close() function. e.prototype.closeTooltip = function() {. this.diagram.tooltipObject.close(). }.
Read more >
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 >
TypeError: Cannot read property 'close' of undefined
I am getting the similar error, so did a bit of digging in the code. I think that if (topologyType === 'mongos') it...
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