mui / material-ui

Material UI: Comprehensive React component library that implements Google's Material Design. Free forever.
https://mui.com/material-ui/
MIT License
93.83k stars 32.26k forks source link

[material-ui][FormControl] Uncaught TypeError: Cannot read properties of undefined (reading 'forEach') #40177

Closed barbalex closed 9 months ago

barbalex commented 10 months ago

Duplicates

Latest version

Steps to reproduce 🕹

Link to live example:

Sorry, I really don't know how to build a live example. I will try if you can help me. A probable reason for this error might be the build environment. I have no idea how to build a live example using the same build environment. My app was created using create-electric-app (https://electric-sql.com/docs/quickstart) which seems to use esbuild directly (without vite).

Current behavior 😯

When I import the component:

import FormControl from '@mui/material/FormControl'

...and then render it inside the component:

<FormControl />

(I know this way of rendering makes no sense but it is the simplest way to provoke the error)

My app does not render any more and this error appears in the console:

compose.js:4 Uncaught TypeError: Cannot read properties of undefined (reading 'forEach')
    at compose.js:4:23
    at Array.reduce (<anonymous>)
    at compose (compose.js:3:27)
    at node_modules/@mui/system/esm/positions.js (positions.js:22:16)
    at __init (index.js:10:56)
    at node_modules/@mui/system/esm/index.js (index.js:19:1)
    at __init (index.js:10:56)
    at IconButton.js:11:1

Importing alone does not yet provoke the error.

I previously had the same problems using other mui parts when developing this app on pop os.

This is my project: https://github.com/barbalex/ps

Expected behavior 🤔

No error

Context 🔦

I am trying to use material-ui in a new project as I have used it in several projects before.

Your environment 🌎

npx @mui/envinfo ``` alexandergabriel@MacBook-Air ps % npx @mui/envinfo Need to install the following packages: @mui/envinfo@2.0.14 Ok to proceed? (y) y System: OS: macOS 14.1.2 Binaries: Node: 19.3.0 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 9.2.0 - /usr/local/bin/npm Browsers: Chrome: 119.0.6045.199 Edge: Not Found Safari: 17.1.2 npmPackages: @emotion/react: 11.11.1 => 11.11.1 @emotion/styled: 11.11.0 => 11.11.0 @mui/base: 5.0.0-beta.26 @mui/core-downloads-tracker: 5.14.20 @mui/material: 5.14.20 => 5.14.20 @mui/private-theming: 5.14.20 @mui/styled-engine: 5.14.20 @mui/system: 5.14.20 @mui/types: 7.2.10 @mui/utils: 5.14.20 @types/react: 18.2.43 => 18.2.43 react: 18.2.0 => 18.2.0 react-dom: 18.2.0 => 18.2.0 typescript: 5.3.3 => 5.3.3 ```
ZeeshanTamboli commented 9 months ago

@barbalex Unfortunately, we won't be able to help you without a reproduction. Could you try to provide a minimal reproduction of the issue? It would be helpful if you could share it on a GitHub repository instead of using CodeSandbox. This way, we can better understand and address the problem.

For questions related to the build and not Material UI, it might be beneficial to ask on StackOverflow.

github-actions[bot] commented 9 months ago

👋 Thanks for using MUI Core!

We use GitHub issues exclusively as a bug and feature requests tracker, however, this issue appears to be a support request.

For support, please check out https://mui.com/getting-started/support/. Thanks!

If you have a question on Stack Overflow, you are welcome to link to it here, it might help others. If your issue is subsequently confirmed as a bug, and the report follows the issue template, it can be reopened.