Skip to content
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

Yarn Berry - missing transitive deps on init #352

Open
osdiab opened this issue Feb 27, 2021 · 1 comment
Open

Yarn Berry - missing transitive deps on init #352

osdiab opened this issue Feb 27, 2021 · 1 comment

Comments

@osdiab
Copy link

osdiab commented Feb 27, 2021

Issue

  1. Install fab cli in a yarn berry project by running yarn add -D @fab/cli (I did this since npx fab init fails as well if I just run it like that)
  2. Run yarn fab init to init the project
  3. Get this failure due to a missing dep in @fab/core:
(node:42371) Error Plugin: @fab/cli: could not find package.json with {
  type: 'core',
  root: '/Users/omar/code/personal/omardiab.com/.yarn/cache/@fab-cli-npm-1.0.0-rc.3-beta.1-058dd416eb-a0bb7e6833.zip/node_modules/@fab/cli',
  name: '@oclif/plugin-help'
}
module: @oclif/config@1.17.0
task: loadPlugins
plugin: @fab/cli
root: /Users/omar/code/personal/omardiab.com/.yarn/cache/@fab-cli-npm-1.0.0-rc.3-beta.1-058dd416eb-a0bb7e6833.zip/node_modules/@fab/cli
See more details with DEBUG=*
(Use `node --trace-warnings ...` to show where the warning was created)
    Error: @fab/core tried to access json-keys-sort, but it isn't declared in its dependencies; this makes the require 
    call ambiguous and unsound.

    Required package: json-keys-sort (via "json-keys-sort")
    Required by: @fab/core@npm:1.0.0-rc.3-beta.1 (via /Users/omar/code/personal/omardiab.com/.yarn/cache/@fab-core-npm-1.
    0.0-rc.3-beta.1-21bf8f1a52-e90d9306d2.zip/node_modules/@fab/core/lib/models/)

    Require stack:
    - /Users/omar/code/personal/omardiab.com/.yarn/cache/@fab-core-npm-1.0.0-rc.3-beta.1-21bf8f1a52-e90d9306d2.zip/node_m
    odules/@fab/core/lib/models/ProtoFab.js
    - /Users/omar/code/personal/omardiab.com/.yarn/cache/@fab-core-npm-1.0.0-rc.3-beta.1-21bf8f1a52-e90d9306d2.zip/node_m
    odules/@fab/core/lib/index.js
    - /Users/omar/code/personal/omardiab.com/.yarn/cache/@fab-cli-npm-1.0.0-rc.3-beta.1-058dd416eb-a0bb7e6833.zip/node_mo
    dules/@fab/cli/lib/commands/init.js
    - /Users/omar/code/personal/omardiab.com/.yarn/cache/@oclif-config-npm-1.17.0-acbde241aa-52b5803062.zip/node_modules/
    @oclif/config/lib/plugin.js
    - /Users/omar/code/personal/omardiab.com/.yarn/cache/@oclif-config-npm-1.17.0-acbde241aa-52b5803062.zip/node_modules/
    @oclif/config/lib/config.js
    - /Users/omar/code/personal/omardiab.com/.yarn/cache/@oclif-config-npm-1.17.0-acbde241aa-52b5803062.zip/node_modules/
    @oclif/config/lib/index.js
    - /Users/omar/code/personal/omardiab.com/.yarn/$$virtual/@oclif-command-virtual-04fd8fde04/0/cache/@oclif-command-npm
    -1.8.0-8a2dc2935e-d0591e56ce.zip/node_modules/@oclif/command/lib/command.js
    - /Users/omar/code/personal/omardiab.com/.yarn/$$virtual/@oclif-command-virtual-04fd8fde04/0/cache/@oclif-command-npm
    -1.8.0-8a2dc2935e-d0591e56ce.zip/node_modules/@oclif/command/lib/index.js
    - /Users/omar/code/personal/omardiab.com/.yarn/cache/@fab-cli-npm-1.0.0-rc.3-beta.1-058dd416eb-a0bb7e6833.zip/node_mo
    dules/@fab/cli/bin/run
    Code: MODULE_NOT_FOUND

Solution

Add the dep explicitly to @fab/core

Workaround

Add this to yarnrc.yml:

packageExtensions:
  "@fab/core@*":
    dependencies:
      "json-keys-sort": "*"
@osdiab osdiab changed the title Yarn Berry - missing json-keys-sort dep on init Yarn Berry - missing transitive deps on init Feb 27, 2021
@osdiab
Copy link
Author

osdiab commented Feb 27, 2021

For my nextJS project I also had a few more missing declarations

  "@fab/core@*":
    dependencies:
      json-keys-sort: "*"
  "@fab/cli@*":
    dependencies:
      "@fab/actions": "*"
  "@fab/actions@*":
    dependencies:
      pretty-bytes: "*"

and ultimately PNP seems to be breaking fab when running fab build:

Error Plugin: @fab/cli: could not find package.json with {
  type: 'core',
  root: '/Users/omar/code/personal/omardiab.com/.yarn/cache/@fab-cli-npm-1.0.0-rc.3-beta.1-058dd416eb-a0bb7e6833.zip/node_modules/@fab/cli',
  name: '@oclif/plugin-help'
}
module: @oclif/config@1.17.0
task: loadPlugins
plugin: @fab/cli
root: /Users/omar/code/personal/omardiab.com/.yarn/cache/@fab-cli-npm-1.0.0-rc.3-beta.1-058dd416eb-a0bb7e6833.zip/node_modules/@fab/cli
See more details with DEBUG=*
(Use `node --trace-warnings ...` to show where the warning was created)
       [Builder] 💎 fab build 💎
       [Builder] Reading plugins from config.
Build failed!

Error occurred requiring /Users/omar/code/personal/omardiab.com/.yarn/cache/@fab-input-nextjs-npm-1.0.0-rc.3-beta.1-c0001e227b-c309455394.zip/node_modules/@fab/input-nextjs/build.js.
Maybe it's using syntax that NodeJS can't interpret?
See https://fab.dev/kb/plugins#restrictions for more info.
    Error: Build failed!

Looks like yarn berry support isn't quite there yet lol

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

No branches or pull requests

1 participant