heroku / heroku-buildpack-nodejs

Heroku's buildpack for Node.js applications.
https://devcenter.heroku.com/articles/buildpacks
MIT License
1.31k stars 2.63k forks source link

Buildpack Test Error When Enabling Heroku CI in a Project Using pnpm #1325

Closed beeeyan closed 2 months ago

beeeyan commented 2 months ago

Summary

When I enable Heroku CI in a project that uses pnpm, the buildpack tests fail with the following error:

 -----> Running Node.js buildpack tests...
 node:fs:1372
   const result = binding.mkdir(
                          ^
 Error: ENOENT: no such file or directory, mkdir '/.heroku/corepack/v1'
     at mkdirSync (node:fs:1372:26)
     at getTemporaryFolder (/app/.heroku/node/lib/node_modules/corepack/dist/lib/corepack.cjs:21486:27)
     at download (/app/.heroku/node/lib/node_modules/corepack/dist/lib/corepack.cjs:21760:21)
     at installVersion (/app/.heroku/node/lib/node_modules/corepack/dist/lib/corepack.cjs:21854:61)
     at async Engine.ensurePackageManager (/app/.heroku/node/lib/node_modules/corepack/dist/lib/corepack.cjs:22310:32)
     at async Engine.executePackageManagerRequest (/app/.heroku/node/lib/node_modules/corepack/dist/lib/corepack.cjs:22410:25)
     at async Object.runMain (/app/.heroku/node/lib/node_modules/corepack/dist/lib/corepack.cjs:23096:5) {
   errno: -2,
   code: 'ENOENT',
   syscall: 'mkdir',
   path: '/.heroku/corepack/v1'
 }
 Node.js v20.17.0
 -----> Node.js buildpack tests failed with exit status 1

Could you please confirm if this behavior is expected?

Versions

Here is the relevant section of my engines configuration:

"engines": {
  "node": "20.x",
  "pnpm": "9.1.3"
}

Workaround

To bypass this issue, I added the following heroku-prebuild script to package.json, which disables corepack:

"heroku-prebuild": "corepack disable && npm install -g pnpm@9.1.3"

Ideally, we would like to be able to use corepack, so is there a solution that allows us to keep using it?

colincasey commented 2 months ago

Hi @beeeyan, there is a fix for this issue (#1320) that will be released on Monday (Sept 23rd).

colincasey commented 2 months ago

@beeeyan The fix for this has been released

beeeyan commented 2 months ago

@colincasey Apologies for the delayed response. I’ve just confirmed that the CI tests are now passing. Thank you for your support and for checking on this! 🙇