mui / mui-x

MUI X: Build complex and data-rich applications using a growing list of advanced React components, like the Data Grid, Date and Time Pickers, Charts, and more!
https://mui.com/x/
3.9k stars 1.19k forks source link

[pickers] Build error because of `@mui/utils/clamp` #13555

Closed Seng-Pursuit closed 2 days ago

Seng-Pursuit commented 1 week ago

Steps to reproduce

Link to live example: (required)

Steps:

  1. run npm install @mui/x-date-pickers
  2. use webpack to bundle

Current behavior

Not building. Complaining about can't resolve clamp. Clamp is used in @mui/x-date-pickers/node_modules/@mui/system/esm/colorManipulator.js import clamp from '@mui/utils/clamp';

Expected behavior

Build successfully

Context

Just build the project.

Your environment

npx @mui/envinfo ``` System: OS: Linux 6.6 Amazon Linux 2 CPU: (10) arm64 unknown Memory: 8.66 GB / 14.62 GB Container: Yes Shell: 4.2.46 - /bin/bash Binaries: Node: 14.21.3 - /usr/bin/node Yarn: 1.22.22 - /usr/bin/yarn npm: 6.14.18 - /usr/bin/npm Managers: Composer: 1.10.23 - /usr/local/bin/composer Yum: 3.4.3 - /usr/bin/yum Utilities: Make: 3.82 - /usr/bin/make GCC: 7.3.1 - /usr/bin/gcc Git: 2.40.1 - /usr/bin/git Curl: 8.3.0 - /usr/bin/curl Servers: Apache: 2.4.59 - /usr/sbin/apachectl IDEs: Nano: 2.9.8 - /usr/bin/nano VSCode: 1.90.1 - /root/.vscode-server/bin/611f9bfce64f25108829dd295f54a6894e87339d-legacy/bin/remote-cli/code Languages: Bash: 4.2.46 - /usr/bin/bash Go: 1.8.3 - /usr/bin/go Perl: 5.16.3 - /usr/bin/perl PHP: 8.0.30 - /usr/bin/php Python: 2.7.18 - /usr/bin/python Databases: MySQL: 10.5.23 (MariaDB) - /usr/bin/mysql SQLite: 3.7.17 - /usr/bin/sqlite3 ```

Search keywords: clamp, utils

Search keywords:

Search keywords:

Seng-Pursuit commented 1 week ago

My guess is that the package.json is wrong

It's currentyly requiring @mui/utils": "^5.15.14

Maybe clamp is only in 5.15.20? I don't know tbh.

I manually install @mui/utils as a workaround and it works now.

This problem might be fixed when you guys bump the packages 3 days ago?

michelengelen commented 1 week ago

@mnajdova not sure if this is a problem with date-pickers... we do not import from @mui/utils/clamp directly. The import also comes from the colormanipulator file. šŸ¤·šŸ¼

flaviendelangle commented 1 week ago

Maybe we bumped the version of @mui/system but not @mui/utils and people can end up with incompatible versions :thinking:

LukasTy commented 1 week ago

In 7.7.0 we have bumped only @mui/system to ^5.15.15 from previous ^5.15.14: https://github.com/mui/mui-x/pull/13000. Maybe it was a mistake on the @mui/material side that they did not release the utils package at the same time... šŸ¤·

Currently, the version is at ^5.15.20: https://github.com/mui/mui-x/blob/0b0f3b4b3c7da9c5b6cefd12a6ee06e91484f702/packages/x-date-pickers/package.json#L50-L51 Bumped with https://github.com/mui/mui-x/pull/13496.

TLDR: the problem should no longer appear after the next release (today or tomorrow).

LukasTy commented 1 week ago

However, the strangest thing is that @mui/system/colorManipulator and @mui/utils have not changed in the past ~4 months. šŸ¤” https://github.com/mui/material-ui/tree/master/packages/mui-utils/src/clamp https://github.com/mui/material-ui/commits/master/packages/mui-system/src/colorManipulator.js

@Seng-Pursuit could you clarify the version of the packages you have installed in your app and the versions listed in package.json? šŸ™

Seng-Pursuit commented 1 week ago

@LukasTy From my package.json

"@mui/material": "^5.15.20",
"@mui/utils": "^5.15.20",
"@mui/x-date-pickers": "^7.7.0",

Obviously I added @mui/utils to fix the problem. Before I do that it's only material and x-date-picker.

This is from my package lock:

"@mui/x-date-pickers": {
      "version": "7.7.0",
      "resolved": "https://registry.npmjs.org/@mui/x-date-pickers/-/x-date-pickers-7.7.0.tgz",
      "integrity": "sha512-huyoA22Vi8iCkee6ro0sX7CcFIcPV/Fl7ZGWwaQC8PTAheXhz823DjMYAiwRU/imF+UFYfUInWQ4XZCIkM+2Dw==",
      "requires": {
        "@babel/runtime": "^7.24.7",
        "@mui/base": "^5.0.0-beta.40",
        "@mui/system": "^5.15.15",
        "@mui/utils": "^5.15.14",
        "@types/react-transition-group": "^4.4.10",
        "clsx": "^2.1.1",
        "prop-types": "^15.8.1",
        "react-transition-group": "^4.4.5"
      }
    },
LukasTy commented 1 week ago

@Seng-Pursuit And what about @mui/utils entries in your lock file? Do you have a single dependency there or is it duplicated? Given that @mui/material@5.15.20 has @mui/utils@5.15.20 dependency means that your package resolver could have duplicated packages which could have caused the issues. The duplication might have come from the fact that @mui/x-date-pickers@7.7.0 still uses @mui/utils@5.15.14.

Consider running the dedupe mechanism to ensure there are no unnecessary duplicate packages.

Seng-Pursuit commented 2 days ago

@LukasTy Thanks, I don't know I can do that. Thank you.

github-actions[bot] commented 2 days ago

:warning: This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

@Seng-Pursuit: How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.