material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

../node_modules/.pnpm/@[email protected][email protected]/node_modules/@mui/styled-engine/StyledEngineProvider/StyledEngineProvider.js (4:9): "CacheProvider" is not exported by "__vite-optional-peer-dep:@emotion/react:@mui/styled-engine", imported by "../node_modules/.pnpm/@[email protected][email protected]/node_modules/@mui/styled-engine/StyledEngineProvider/StyledEngineProvider.js"

Open tuanductran opened this issue 1 year ago • 2 comments

web:build: error during build: web:build: ../node_modules/.pnpm/@[email protected][email protected]/node_modules/@mui/styled-engine/StyledEngineProvider/StyledEngineProvider.js (4:9): "CacheProvider" is not exported by "vite-optional-peer-dep:@emotion/react:@mui/styled-engine", imported by "../node_modules/.pnpm/@[email protected][email protected]/node_modules/@mui/styled-engine/StyledEngineProvider/StyledEngineProvider.js". web:build: file: /Users/trantuanduc/Downloads/find-compatible-version/node_modules/.pnpm/@[email protected][email protected]/node_modules/@mui/styled-engine/StyledEngineProvider/StyledEngineProvider.js:4:9 web:build: web:build: 2: web:build: 3: import * as React from 'react'; web:build: 4: import PropTypes from 'prop-types'; web:build: ^ web:build: 5: import { CacheProvider } from '@emotion/react'; web:build: 6: import createCache from '@emotion/cache'; web:build: web:build: at getRollupError (file:///Users/trantuanduc/Downloads/find-compatible-version/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/parseAst.js:392:41) web:build: at error (file:///Users/trantuanduc/Downloads/find-compatible-version/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/parseAst.js:388:42) web:build: at Module.error (file:///Users/trantuanduc/Downloads/find-compatible-version/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:14844:16) web:build: at Module.traceVariable (file:///Users/trantuanduc/Downloads/find-compatible-version/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:15291:29) web:build: at ModuleScope.findVariable (file:///Users/trantuanduc/Downloads/find-compatible-version/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:13192:39) web:build: at FunctionScope.findVariable (file:///Users/trantuanduc/Downloads/find-compatible-version/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:5221:38) web:build: at FunctionBodyScope.findVariable (file:///Users/trantuanduc/Downloads/find-compatible-version/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:5221:38) web:build: at Identifier.bind (file:///Users/trantuanduc/Downloads/find-compatible-version/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:4871:40) web:build: at CallExpression.bind (file:///Users/trantuanduc/Downloads/find-compatible-version/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:2832:28) web:build: at CallExpression.bind (file:///Users/trantuanduc/Downloads/find-compatible-version/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:11148:15) web:build: at ConditionalExpression.bind (file:///Users/trantuanduc/Downloads/find-compatible-version/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:2836:23) web:build: at ReturnStatement.bind (file:///Users/trantuanduc/Downloads/find-compatible-version/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:2836:23) web:build: at BlockStatement.bind (file:///Users/trantuanduc/Downloads/find-compatible-version/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:2832:28) web:build: at FunctionDeclaration.bind (file:///Users/trantuanduc/Downloads/find-compatible-version/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:2836:23) web:build: at ExportDefaultDeclaration.bind (file:///Users/trantuanduc/Downloads/find-compatible-version/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:2836:23) web:build: at Program.bind (file:///Users/trantuanduc/Downloads/find-compatible-version/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:2832:28) web:build: at Module.bindReferences (file:///Users/trantuanduc/Downloads/find-compatible-version/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:14823:18) web:build: at Graph.sortModules (file:///Users/trantuanduc/Downloads/find-compatible-version/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:20225:20) web:build: at Graph.build (file:///Users/trantuanduc/Downloads/find-compatible-version/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:20128:14) web:build: at async file:///Users/trantuanduc/Downloads/find-compatible-version/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:20772:13 web:build: at async catchUnfinishedHookActions (file:///Users/trantuanduc/Downloads/find-compatible-version/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:20282:16) web:build: at async rollupInternal (file:///Users/trantuanduc/Downloads/find-compatible-version/node_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/node-entry.js:20767:5) web:build: at async build (file:///Users/trantuanduc/Downloads/find-compatible-version/node_modules/.pnpm/[email protected]@[email protected]/node_modules/vite/dist/node/chunks/dep-CDnG8rE7.js:65386:14) web:build: at async CAC. (file:///Users/trantuanduc/Downloads/find-compatible-version/node_modules/.pnpm/[email protected]@[email protected]/node_modules/vite/dist/node/cli.js:828:5) web:build:  ELIFECYCLE  Command failed with exit code 1. web:build: ERROR: command finished with error: command (/Users/trantuanduc/Downloads/find-compatible-version/web) /Users/trantuanduc/Library/pnpm/pnpm run build exited (1) web#build: command (/Users/trantuanduc/Downloads/find-compatible-version/web) /Users/trantuanduc/Library/pnpm/pnpm run build exited (1)

Search keywords:

tuanductran avatar Oct 15 '24 01:10 tuanductran

Can you share a bit more info on your project, or share a reproduction that we can look into? What framework do you use? What's the set up, etc.

mnajdova avatar Oct 15 '24 11:10 mnajdova

Looked deeper into the original issue. This seems to be something else after all. Opening a ticket in https://github.com/mui/material-ui/issues/44112


Seeing something similar in Toolpad Studio as well. @mui/[email protected] is not compatible with @mui/[email protected] even though the latter declares its dependency on @mui/styled-engine as ^6.1.1. Something similar is going on with @mui/utils.

There's a workaround described in https://github.com/mui/toolpad/issues/4257 that uses package manager resolutions.

Reproductions:

  • reproduction for internal_processStyles in Stackblitz
  • reproduction for @mui/utils/getReactNodeRef in Stackblitz

Looks like it's caused by a set of breaking changes to internal APIs:

  • Offending PR https://github.com/mui/material-ui/pull/43412 that removes the internal_processStyles in @mui/styled-engine.
  • Offending PR https://github.com/mui/material-ui/pull/43022 that removes @mui/utils/getReactNodeRef

cc @oliviertassinari interesting case where we export something called internal_ but that we can't break on a patch as our internal dependencies don't allow for that. Beginning to realize there is no way of having the cake and eating it too. exporting anything from a package that's used by another MUI package means respecting semver, regardless of whether or not we allow end-users to import it.

Janpot avatar Oct 15 '24 14:10 Janpot

Since the issue is missing key information and has been inactive for 7 days, it has been automatically closed. If you wish to see the issue reopened, please provide the missing information.

github-actions[bot] avatar Oct 22 '24 12:10 github-actions[bot]

@tuanductran not sure if it relevant anymore, but for me installing dependency @emotion/react did the trick

piotr7109 avatar Mar 15 '25 12:03 piotr7109