yarnpkg / berry

📦🐈 Active development trunk for Yarn ⚒
https://yarnpkg.com
BSD 2-Clause "Simplified" License
7.47k stars 1.12k forks source link

[Bug?]: Invalid option name ("--production=false") #4608

Open dtinth opened 2 years ago

dtinth commented 2 years ago

Self-service

Describe the bug

Heroku’s Node.js buildpack is hardcoded to install packages using yarn install --production=false

https://github.com/heroku/buildpacks-nodejs/blob/c6537360d8f4241d20118bacd04b0a43aea0bc6f/buildpacks/yarn/lib/build.sh#L82-L88

It works with Yarn Classic, but with Yarn Berry it fails.

To reproduce

// Heroku hardcodes "--production=false" in their buildpack.
// https://github.com/heroku/buildpacks-nodejs/blob/c6537360d8f4241d20118bacd04b0a43aea0bc6f/buildpacks/yarn/lib/build.sh#L82-L88
const output = await yarn(`install`, `--production=false`)
  .catch(e => {
    if (!e.code) throw e
    return e.stdout + e.stderr
  });
expect(output).not.toContain(`Invalid option name`);

Environment

System:
    OS: macOS 12.3
    CPU: (8) x64 Apple M1
  Binaries:
    Node: 16.15.1 - /private/var/folders/qk/bxhj0cs55vv8n4ghq8xh0k1h0000gn/T/xfs-189882af/node
    Yarn: 3.2.1 - /private/var/folders/qk/bxhj0cs55vv8n4ghq8xh0k1h0000gn/T/xfs-189882af/yarn
    npm: 8.11.0 - ~/.volta/tools/image/node/16.15.1/bin/npm

Additional context

There is an issue open in Heroku’s org since April:

Almost 3 months elapsed and no fix from Heroku side so far. Therefore I am filing this issue on Yarn side, hope that either party will be willing to work together to become more interoperable.

Thank you!

yarnbot commented 2 years ago

Hi! 👋

This issue looks stale, and doesn't feature the reproducible label - which implies that you didn't provide a working reproduction using Sherlock. As a result, it'll be closed in a few days unless a maintainer explicitly vouches for it or you edit your first post to include a formal reproduction (you can use the playground for that).

Note that we require Sherlock reproductions for long-lived issues (rather than standalone git repositories or similar) because we're a small team. Sherlock gives us the ability to check which bugs are still affecting the master branch at any given point, and decreases the amount of code we need to run on our own machines (thus leading to faster bug resolutions). It helps us help you! 😃

If you absolutely cannot reproduce a bug on Sherlock (for example because it's a Windows-only issue), a maintainer will have to manually add the upholded label. Thanks for helping us triaging our repository! 🌟

dtinth commented 2 years ago

The issue already has a reproduction. I tried using the Playground linked above, but it gives this error:

image
dtinth commented 2 years ago

I updated the repro script. Since Playground above was not working, I ran it offline instead.

image
arcanis commented 2 years ago

I'm not sure what's the difference between buildspack-nodejs and heroku-buildpack-nodejs, but the second has Yarn 3+ support along with a few settings (YARN2_SKIP_PRUNING). Given that both are seemingly maintained by Heroku, I'd try to use it.

dtinth commented 2 years ago

@arcanis Here are the differences:

Although they are both called “buildpack” they are 2 different things.

jagthedrummer commented 6 months ago

It would be nice if --production=false would at least be a noop instead of throwing an error so that this wouldn't be a problem.

jagthedrummer commented 6 months ago

I discovered that reordering our buildpacks on Heroku made this problem go away. Having heroku/nodejs after heroku/ruby would trigger the Invalid option name ("--production=false") problem. But having heroku/nodejs first in the list fixed it.