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

[Bug]: Yarn berry can't be used, please bump oclif version and change config.plugins to [...config.plugins.values()] #3004

Closed
2 tasks done
danieltroger opened this issue Oct 20, 2023 · 17 comments
Labels
Area: @shopify/cli-kit @shopify/cli-kit package issues Type: Bug Something isn't working

Comments

@danieltroger
Copy link

danieltroger commented Oct 20, 2023

Please confirm that you have:

  • Searched existing issues to see if your issue is a duplicate. (If you’ve found a duplicate issue, feel free to add additional information in a comment on it.)
  • Reproduced the issue in the latest CLI version.

In which of these areas are you experiencing a problem?

App

Expected behavior

I can run yarn shopify app dev with yarn berry (yarn v3/v4)

Actual behavior

Before you update @oclif/core:

╭─ error ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                                              │
│  command app:dev not found                                                                                                                                                   │
│                                                                                                                                                                              │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

After you update @oclif/core to at least 3.4.1-dev.0:

╭─ error ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                                │
│  config.plugins.map is not a function                                                                                                          │
│                                                                                                                                                │
│  To investigate the issue, examine this stack trace:                                                                                           │
│    at registerCleanBugsnagErrorsFromWithinPlugins                                                                                              │
│    (.yarn/unplugged/@shopify-cli-kit-npm-3.49.5-f269164f4b/node_modules/@shopify/cli-kit/src/public/node/error-handler.ts:161)                 │
│      config.plugins.map(async (plugin) => {                                                                                                    │
│    at init (.yarn/unplugged/@shopify-cli-kit-npm-3.49.5-f269164f4b/node_modules/@shopify/cli-kit/src/public/node/base-command.ts:39)           │
│      await registerCleanBugsnagErrorsFromWithinPlugins(this.config)                                                                            │
│                                                                                                                                                │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

After you have done this change: oclif/core#839 (comment), related line in your code:

config.plugins.map(async (plugin) => {

It should work :)

Reproduction steps

  1. Please see Oclif can't find plugins when using yarn pnp/yarn 4 oclif/core#806
  2. If something's still unclear, please see feat: better support yarn PnP oclif/core#839

Operating System

macOS 14.0 (23A344)

Shopify CLI version (check your project's package.json if you're not sure)

@shopify/cli@3.50.0

Shell

zsh

Node version (run node -v if you're not sure)

v20.5.0

What language and version are you using in your application?

TypeScript 4.9.4

@danieltroger danieltroger added the Type: Bug Something isn't working label Oct 20, 2023
@Arkham Arkham added the Area: @shopify/cli-kit @shopify/cli-kit package issues label Oct 23, 2023
@Arkham
Copy link
Contributor

Arkham commented Oct 23, 2023

Hey, thanks for opening this. I think I'll wait to implement this after oclif releases a new stable.

@WillieRuemmele
Copy link

Hi @danieltroger - I just merged that OCLIF PR, version 3.6.0 is published 🚀

thanks for all of your work and back and forth with Mike 😄

@isaacroldan
Copy link
Contributor

Hi @danieltroger, unfortunately we can't upgrade to oclif v3 yet because we haven't formally dropped node 16 support (oclif 3 does). We will eventually, but can't promise any dates. In the meantime my only recommendation would be not to use yarn berry, sorry.

@danieltroger
Copy link
Author

Hi @isaacroldan, using yarn berry significantly simplifies development for us so not using it isn't an alternative unfortunately.
I've already patched the shopify CLI using yarn patch, so for us everything works now (except updates being cumbersome) but it would be great if you would get back to this as soon as you drop node 16 support (is there a timeline for that?) :)

@isaacroldan
Copy link
Contributor

No timeline yet, still discussing it internally, but I'll keep this issue open and update it once we have more news
Glad that you at least have a workaround :)

Copy link
Contributor

This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action.
→ If there's no activity within a week, then a bot will automatically close this.
Thanks for helping to improve Shopify's dev tooling and experience.

P.S. You can learn more about why we stale issues here.

@danieltroger
Copy link
Author

Waiting for shopify to drop node 16 support. Here's some activity so the issue doesn't get closed

@isaacroldan
Copy link
Contributor

We are almost there: #2975 :)

@danieltroger
Copy link
Author

Niiice :)

@rista404
Copy link

Just encountered this issue in the latest @shopify/cli@3.54.0 after bumping. I'm using node v21.5.0 and npm 10.2.4. The error is the following:

> shopify hydrogen dev --codegen --worker

╭─ error ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                                          │
│  config.plugins.map is not a function                                                                                                    │
│                                                                                                                                          │
│  To investigate the issue, examine this stack trace:                                                                                     │
│    at registerCleanBugsnagErrorsFromWithinPlugins                                                                                        │
│    (@shopify/cli-hydrogen/node_modules/@shopify/cli-kit/src/public/node/error-handler.ts:170)                                            │
│      config.plugins.map(async (plugin) => {                                                                                              │
│    at init (@shopify/cli-hydrogen/node_modules/@shopify/cli-kit/src/public/node/base-command.ts:40)                                      │
│      await registerCleanBugsnagErrorsFromWithinPlugins(this.config)                                                                      │
│    at async runCLI (@shopify/cli-kit/src/public/node/cli.ts:88)                                                                          │
│      await run(undefined, options.moduleURL)                                                                                             │
│    at async runShopifyCLI (@shopify/cli/src/index.ts:42)                                                                                 │
│      await runCLI({                                                                                                                      │
│                                                                                                                                          │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯

Reverting to 3.52.0 fixed the problem.

@danieltroger
Copy link
Author

danieltroger commented Jan 26, 2024

@isaacroldan Did you bump oclif but forget to make this change? oclif/core#839 (comment) config.plugins is a Map in the new oclif version IIRC

@isaacroldan
Copy link
Contributor

I think this is an issue with Hydrogen, they are using an older version of cli-kit without the fixes for oclif 3.
I'll talk to them to fix this.

@isaacroldan
Copy link
Contributor

@rista404 how are you using the CLI? did you install it globally along with hydrogen?

@rista404
Copy link

@isaacroldan all packages are installed locally in a Hydrogen project.

Packages in question are @shopify/cli, @shopify/cli-hydrogen, and @shopify/hydrogen, and I run them like so: shopify hydrogen dev --codegen --worker. I think it's the same error with or without the custom flags on the latest @shopify/cli version.

Seems like having @shopify/cli-hydrogen@6.1.0 didn't cause any problems. Hope this helps!

@isaacroldan
Copy link
Contributor

Right, the issue is that all those packages are actually inter-dependent, so you can't update just @shopify/cli as it might break hydrogen (like in this case)
The correct way to update a hydrogen project is by running shopify hydrogen upgrade, that will upgrade all packages, but hydrogen hasn't released yet a new version so the latest they support for @shopify/cli is 3.52.0 still.

I'll bring this up with the Hydrogen team anyway

@danieltroger
Copy link
Author

danieltroger commented Jan 31, 2024

@isaacroldan seems like this issue can be closed now? I just removed my patches and updated all shopify cli packages to the latest version and everything seems to work fine under yarn berry now 🥳🤩

@isaacroldan
Copy link
Contributor

Awesome, glad to hear that @danieltroger, closing the issue now then :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: @shopify/cli-kit @shopify/cli-kit package issues Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants