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 properties of undefined (reading 'dark')

See original GitHub issue
  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

I am migrating a project create with create-react-app from v5, and I am getting the following error for every page:

image

Expected Behavior 🤔

An app should load.

Steps to Reproduce 🕹

This was causing the issue:

<Button
            variant="contained"
            color="default"
            size="medium"
            startIcon={<AddIcon />}
            component={Link}
            to="/create"
          >

Removing color property fixed the issue.

Context 🔦

Your Environment 🌎

`npx @mui/envinfo`

I use Google Chrome.

  System:
    OS: macOS 11.6
  Binaries:
    Node: 14.4.0 - /usr/local/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 7.20.1 - /usr/local/bin/npm
  Browsers:
    Chrome: 93.0.4577.82
    Edge: Not Found
    Firefox: 88.0.1
    Safari: 14.1.2
  npmPackages:
    @emotion/react: ^11.4.1 => 11.4.1 
    @emotion/styled: ^11.3.0 => 11.3.0 
    @mui/core:  5.0.0-alpha.47 
    @mui/icons-material: ^5.0.0 => 5.0.0 
    @mui/material: ^5.0.0 => 5.0.0 
    @mui/private-theming:  5.0.0 
    @mui/styled-engine:  5.0.0 
    @mui/system:  5.0.0 
    @mui/types:  7.0.0 
    @mui/utils:  5.0.0 
    @types/react:  17.0.21 
    react: ^17.0.2 => 17.0.2 
    react-dom: ^17.0.2 => 17.0.2 
    typescript:  4.4.3 

Issue Analytics

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

github_iconTop GitHub Comments

16reactions
mnajdovacommented, Sep 20, 2021

The button no longer support the default color. These are the valid color values:

'inherit', 'primary', 'secondary', 'success', 'error', 'info', 'warning'

See the API page - https://mui.com/api/button/

3reactions
TrustyTechSGcommented, Sep 19, 2021

Im also getting this error on my nextJS project with v5, my is “Cannot read properties of undefined (reading ‘main’)”

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read properties of undefined (reading 'dark')
TypeError : Cannot read properties of undefined (reading 'dark'). I've checked the previous errors and MaterialUI site, but could not figure ...
Read more >
TypeError: Cannot read properties of undefined (reading 'dark ...
The issue is present in the latest release. I have searched the issues of this repository and believe that this is not a...
Read more >
cannot read properties of undefined (reading 'dark') - You.com
There are 3 main reasons the "Cannot read properties of undefined" error occurs: Accessing a property on a variable that stores an undefined...
Read more >
Uncaught TypeError: Cannot read properties undefined
[This thread is closed.] Javascript Error: Uncaught TypeError: Cannot read properties of undefined (reading 'setAttribute') at Object.menu…
Read more >
[Vue warn]: Error in render: "TypeError - Laracasts
... in render: "TypeError: Cannot read property 'smAndDown' of undefined" ... xs4> <v-btn @click="sendMessage" dark class="mt-3 ml-2 white--text" small ...
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