heroku / buildpacks-nodejs

Heroku's Cloud Native Buildpacks for Node.js applications.
BSD 3-Clause "New" or "Revised" License
2 stars 2 forks source link

Yarn2+ Broken after PR#201 #246

Closed zenchild closed 1 year ago

zenchild commented 2 years ago

PR #201 introduced a regression for Yarn2 (or 3 in our case). What was previously a successful build, now errors out with the following when it gets to the yarn buildpack:

---> Installing node modules from ./yarn.lock
Unknown Syntax Error: Invalid option name ("--production=false").

$ yarn install [--json] [--immutable] [--immutable-cache] [--check-cache] [--inline-builds] [--mode #0]
ERROR: failed to build: exit status 1
ERROR: failed to build: executing lifecycle: failed with status code: 51

I am able to work around this for now by specifying a version for the heroku/nodejs-yarn builldpack.

So, this is currently broken:

pack build myproj -v \
    -B "heroku/buildpacks:20" \
    -b "heroku/nodejs,heroku/ruby" \
    -p .

But this works around my issue:

pack build myproj -v \
    -B "heroku/buildpacks:20" \
    -b "heroku/nodejs-engine,heroku/nodejs-yarn@0.2.1,heroku/ruby" \
    -p .
joshwlewis commented 2 years ago

Thanks for the report. Indeed, this is not ideal for yarn 2 users.

jtkiesel commented 2 years ago

If anyone else is using Railway, I was able to employ the same workaround with a project.toml file at the root of my project with the following contents:

[[build.buildpacks]]
uri = "heroku/nodejs-engine"

[[build.buildpacks]]
uri = "heroku/nodejs-yarn@0.2.1"
dtinth commented 2 years ago

Since 3 months has passed without a fix from Heroku side, I am creating a corresponding issue on Yarn side, hoping that either party will be willing to work together to become more interoperable.

schabr06 commented 2 years ago

Is there any time table on when a fix for this will be introduced?

tomh4 commented 1 year ago

This is still an issue...

colincasey commented 1 year ago

@joshwlewis #250 should fix this, right?

joshwlewis commented 1 year ago

Yes, please keep your eye on #250, which should solve this.

joshwlewis commented 1 year ago

@zenchild - the new yarn buildpack shipped in #250. You might want to check that out.

zenchild commented 1 year ago

Thanks @joshwlewis ! I'll have a look.

harmyderoman commented 1 year ago

I started getting this error after February 9 in two different repos. For yarn 1, I fixed it by writing the exact version in package.json:

  "engines": {
    "node": ">= 10.18.1",
    "npm": ">= 6.13.4",
    "yarn": "1.21.1"
  },

For yarn 3, you must commit the yarn file to the GitHub repo. The yarn file is located in .yarn/releases/yarn-3.4.1.cjs. I hope it will help you!

jagthedrummer commented 5 months ago

@joshwlewis Can you recommend how one would take advantage of the changes in #250? I'm not finding anything there that indicates what changes should be made in a project.

jagthedrummer commented 5 months ago

I finally discovered that reordering our buildpacks did the trick. 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.