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.

[lab] Incomplete peerDependencies break usage with yarn pnp

See original GitHub issue

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

Yarn PnP (Plug’n’Play) is more strict when it comes to specifying a library’s peerDependencies correctly. Currently, @mui/lab is missing the following entries in peerDependencies as they are peerDependencies of @mui/x-date-pickers:

  • @emotion/react
  • @emotion/styled

This causes errors like this one:

ERROR in resolving fallback for shared module @emotion/styled
Module not found: Error: @mui/styled-engine tried to access @emotion/styled (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.

Required package: @emotion/styled
Required by: @mui/styled-engine@virtual:7a413bb353e548319c90adb82631b0c089acd1a802fdcf34c7a70f0d92986c9f29874633545bb7dc3d02df8b9ae9870617074e94e1a662f0e58596867aac2836#npm:5.6.1 (via /workspace-root/.yarn/__virtual__/@mui-styled-engine-virtual-d4f5f5ea46/0/cache/@mui-styled-engine-npm-5.6.1-06c551ec66-cd17d05902.zip/node_modules/@mui/styled-engine/)

Ancestor breaking the chain: @mui/lab@virtual:be640854c908ca72c5c45d17e3a5d76a2c579538ed551547b39edc486c90638abf94c25a34fa05a0a9167f796b8fb98e280e0bad9b44c61172fe75f4bcf39869#npm:5.0.0-alpha.80

Expected behavior 🤔

If the mentioned packages were added to peerDependencies, these errors would not occur with yarn pnp.

It would maybe also make sense to add them as optional peer dependencies because mui can also be used with styled-components instead of emotion.

Steps to reproduce 🕹

This bug is connected to https://github.com/mui/mui-x/issues/4761. I created a PR to fix the issue on @mui/x-date-pickers but after that, this library depending on @mui/x-date-pickers will have the same problem as it also doesn’t declare these peer deps. So reproduction for this issue would be the same (also after mui-x is fixed):

  1. Set up a new react app (i.e. via CRA) npx create-react-app mui-x-date-pickers
  2. Make sure you have yarn installed
  3. run yarn set version berry in order to get the latest yarn version with pnp
  4. run yarn add @mui/lab @mui/material @mui/system
  5. Implement usage of one of these date pickers:
import {CalendarPicker} from '@mui/lab';

function App() {
  const handleDateChange = () => {
  };

  return (
    <CalendarPicker
      date={null}
      onChange={handleDateChange}
    />
  );
}

export default App;
  1. start the app --> errors appear.

Context 🔦

I’m in an environment where I rely heavily upon yarn functionalities (yarn workspaces, pnp, etc.). This issue is a major blocker for me.

Your environment 🌎

`npx @mui/envinfo`
  System:
    OS: macOS 12.3.1
  Binaries:
    Node: 16.11.1 - /opt/javascript/ncanode/16.11.1/node/bin/node
    Yarn: 3.2.0 - /opt/javascript/ncayarn/1.22.4/bin/yarn
    npm: 8.0.0 - /opt/javascript/ncanode/16.11.1/node/bin/npm
  Browsers:
    Chrome: 101.0.4951.54
    Edge: Not Found
    Firefox: 99.0.1
    Safari: 15.4
  Browser used: Brave [Version 1.37.116 Chromium: 100.0.4896.127 (Official Build)]

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
nate-summercookcommented, May 7, 2022

@oliviertassinari @nate-summercook maybe it’s caused by the -alpha.0 dependency (instead of -alpha.2) here: https://github.com/mui/material-ui/blob/master/packages/mui-lab/package.json#L75

No, I did try with -alpha.2 (through resolutions. Didn’t fix the problem.

0reactions
nate-summercookcommented, May 17, 2022

@nate-summercook Please provide a minimal reproduction. @mui/x-date-pickers is not supposed to be used though @mui/lab for new projects. In step 4, you also need to install @emotion/react and @emotion/styled in your project.

I’m not using @mui/x-date-pickers through @mui/lab, but the fact that it’s contained within @mui/lab lets yarn pnp fail already because the peerDependencies are not declared.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Plug'n'Play | Yarn - Package Manager
An overview of Plug'n'Play, a powerful and innovative installation strategy for Node.
Read more >
how to install express in console Code Example
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution). ... E: The repository 'http://ppa.launchpad.net/certbot/certbot/ ...
Read more >
Typescript | Package Hub
A utility to parse editorjs clean data to HTML. Use it with plain Javascript/Typescript, React, Angular, Vue or any templating engine/framework of your...
Read more >
Syntax - Tasty Web Development Treats - Podcast Addict
Syntax - Tasty Web Development Treats - via Podcast Addict | Full Stack Developers Wes Bos and Scott Tolinski dive deep into web...
Read more >
Syntax - Tasty Web Development Treats - Wes Bos & Scott ...
Break pages into sections of components using React, Vue, or whatever you like. ... 21:49 - lch(), lab(), hwb() notation ... Yarn PnP...
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