Describe the bug
Using Yarn v2 workspace (node_modules linker, not PnP), the build will fail if heroku-prebuild is defined in the root package.json
To Reproduce
Steps to reproduce the behavior:
- Use Yarn v2 workspace
- Define a
heroku-prebuild script in root package.json.
The script could be as simple as:
{
"scripts": {
"heroku-prebuild": "ls"
}
}
- Deploy it (tested with
git push heroku main or dpl --provider=heroku, it doesn't matter)
- Sufficient to see the error
Versions (please complete the following information):
- Heroku Stack:
heroku-20
- Node Version:
14.x
- NPM or Yarn Version:
2.4.0
- Buildpack Version: Latest at the time of writing, Not pinned
Additional context
- If
heroku-prebuild is not defined, the installation always works.
NODE_MODULES_CACHE has been disabled or enabled, the error persists.
NPM_CONFIG_PRODUCTION and YARN_PRODUCTION has been unset as per the official migration guide, the error still persists
- No other buildpacks interfering
- No output seen on the log for the
heroku-prebuild script (suggesting that maybe it wasn't even run)
Log output (trimmed):
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
USE_YARN_CACHE=true
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=false
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
engines.yarn (package.json): unspecified (use default)
Resolving node version 14.x...
Downloading and installing node 14.16.0...
Using default npm version: 6.14.11
Resolving yarn version 1.22.x...
Downloading and installing yarn (1.22.10)
Using yarn 2.4.0
-----> Restoring cache
Caching has been disabled because NODE_MODULES_CACHE=false
-----> Prebuild
Running heroku-prebuild (yarn)
Usage Error: Couldn't find the node_modules state file - running an install might help (findPackageLocation)
$ yarn run [--inspect] [--inspect-brk] <scriptName> ...
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
Describe the bug
Using Yarn v2 workspace (node_modules linker, not PnP), the build will fail if
heroku-prebuildis defined in the rootpackage.jsonTo Reproduce
Steps to reproduce the behavior:
heroku-prebuildscript in root package.json.The script could be as simple as:
{ "scripts": { "heroku-prebuild": "ls" } }git push heroku mainordpl --provider=heroku, it doesn't matter)Versions (please complete the following information):
heroku-2014.x2.4.0Additional context
heroku-prebuildis not defined, the installation always works.NODE_MODULES_CACHEhas been disabled or enabled, the error persists.NPM_CONFIG_PRODUCTIONandYARN_PRODUCTIONhas been unset as per the official migration guide, the error still persistsheroku-prebuildscript (suggesting that maybe it wasn't even run)Log output (trimmed):