Skip to content

Missing dependencies when using yarn 2 #1716

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
boerngen-schmidt opened this issue Mar 12, 2021 · 3 comments
Closed

Missing dependencies when using yarn 2 #1716

boerngen-schmidt opened this issue Mar 12, 2021 · 3 comments
Labels
Milestone

Comments

@boerngen-schmidt
Copy link

Describe the bug
It seems that the @jsonforms/core package requires tslib, lodash and prop-types as installed dependency. I could also recreate this issue with the jsonforms-react-seed, so I'll be using it for the bug report as base.

Failed to compile.

./.yarn/cache/@jsonforms-core-npm-2.5.0-a001c716d3-55644c8c1a.zip/node_modules/@jsonforms/core/lib/generators/uischema.js
Module not found: @jsonforms/core tried to access tslib, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

./.yarn/$$virtual/@jsonforms-material-renderers-virtual-d60f75eb17/0/cache/@jsonforms-material-renderers-npm-2.5.0-452d6c3961-a9d07b93bb.zip/node_modules/@jsonforms/material-renderers/lib/complex/CombinatorProperties.js
Module not found: @jsonforms/material-renderers tried to access lodash, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

./.yarn/$$virtual/@material-ui-pickers-virtual-c2c0146eff/0/cache/@material-ui-pickers-npm-3.3.10-f5e6b01c73-295219264b.zip/node_modules/@material-ui/pickers/esm/Calendar-11ae61f6.js
Module not found: @material-ui/pickers tried to access prop-types (a peer dependency) but it isn't provided by its ancestors; this makes the require call ambiguous and unsound.

To Reproduce

  1. git clone https://github.com/eclipsesource/jsonforms-react-seed.git && cd jsonforms-react-seed
  2. use yarn 2 aka npm install -g yarn && yarn set version berry && yarn install
  3. yarn start

To Fix issue

  1. yarn add tslib lodash prop-types
  2. yarn start

Expected behavior
Expected yarn 2 to install all necessary dependencies to run the app

Additional context
After manually adding I was able to run yarn start without a compile error, but then this happend

TypeScript error in C:/Development/git/jsonforms-react-seed/src/App.tsx(8,20):
Cannot find module './schema.json' or its corresponding type declarations.  TS2307

     6 | import logo from './logo.svg';
     7 | import './App.css';
  >  8 | import schema from './schema.json';
       |                    ^
     9 | import uischema from './uischema.json';
    10 | import {
    11 |   materialCells,

I do not know if this is a problem on my side, since I also experienced this in other apps I wrote. The error was solved by commenting the imports and use

const schema = require('./schema.json');
const uischema = require('./uischema.json');
@sdirix
Copy link
Member

sdirix commented Mar 31, 2021

Thanks for the report. Support for yarn2 is currently not in the shortlist of our priorities, however as it becomes more popular we'll certainly take a look. If you have experience with yarn2 and solved the issues you described we would also happily accept a contribution.

@sdirix sdirix added this to the Backlog milestone Mar 31, 2021
@sdirix sdirix added the dev label Mar 31, 2021
@Sewdn
Copy link

Sewdn commented Jul 28, 2023

@sdirix This is not only for yarn2, but all later version that support PlugAndPlay.

The issue is not that hard to fix: declare the dependencies of the npm packages you are using in your package.json file. This should be done anyway imo to adhere to best practices in maintaining a library.

I hope bumping this issue, will help you to fix this in the next version. Thanks a lot!

@lucas-koehler
Copy link
Contributor

Hi @Sewdn , thank you for the reminder.
We recently switched to pnpm with #2148 . As we don't hoist dependencies anymore as before, we declared dependencies explicitly in this PR. Thus, I will close this issue now.
If you still notice these issues from version v3.1.1-alpha.0 onwards, feel free to reopen this issue or open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants