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

Yarn 4 with `packageManager` is failing with `"The 'yarnPath' could not be read from the 'yarnrc.yml' file"` #732

Closed Swiftwork closed 11 months ago

Swiftwork commented 11 months ago

Our builds using heroku/nodejs and Yarn 4 with installs are failing to find yarnPath:

 !     The 'yarnPath' could not be read from the 'yarnrc.yml' file
      It looks like 'yarnrc.yml' is missing the 'yarnPath' value, which is needed
      to identify the location of yarn for this build.
      To regenerate 'yarnrc.yml' with the 'yarnPath' value set, make sure Yarn 2
      is installed on your local machine and set the version in your project
      directory with:
       $ yarn set version berry
      Read more at the Yarn docs: https://yarnpkg.com/getting-started/install#per-project-install

       https://devcenter.heroku.com/articles/nodejs-support
 !     Push rejected, failed to compile Node.js app.
 !     Push failed

Locally everything works provided corepack enable is run beforehand.

# .yarnrc.yml

nodeLinker: node-modules
// package.json

{
  // ...
  "packageManager": "yarn@4.0.2",
  // ...
}

This is the suggested [installation way by Yarn](https://yarnpkg.com/getting-started/install#per-project-install, to not include a yarnPath in the .yarnrc.yml as is done in the test fixture:

https://github.com/heroku/buildpacks-nodejs/blob/v2.3.0/buildpacks/nodejs-yarn/tests/fixtures/yarn-4-modules-zero/.yarnrc.yml#L3

Can you confirm that it is working on your side with a test fixture for Yarn 4, nodeLinker: node-modules (non-zero), "packageManager": "yarn@4.0.0", and no yarnPath?

Swiftwork commented 11 months ago

Closing the issue as I didn't realize I needed to use https://github.com/heroku/heroku-buildpack-nodejs for builds on the Heroku platform. I thought this project was a successor.

arthur5005 commented 11 months ago

@Swiftwork I'm still running into this issue while pointing to that buildpack https://github.com/heroku/heroku-buildpack-nodejs in my app.json, did you resolve how to support yarn 4 without a yarnPath?

Swiftwork commented 11 months ago

@Swiftwork I'm still running into this issue while pointing to that buildpack https://github.com/heroku/heroku-buildpack-nodejs in my app.json, did you resolve how to support yarn 4 without a yarnPath?

We weren't able to. Just set the "yarnPath" to 4.0.1 as they have a weird check requiring the path. Not sure if it is actually used.