Do you want to request a feature or report a bug?
bug
What is the current behavior?
We recently switched from installing only dependencies to a flow where devDependencies are also installed, the build steps run, and then the devDependencies are pruned out for users on Heroku.
My understanding is that we must ignore scripts in this case, because many of our users define their build step in a postinstall script, and this would be re-run.
However this additional flag also invalidates the integrity check, which causes a lot of extra work including rebuilds of native dependencies. We can see in our metrics that pruning with Yarn takes several times as long as pruning with npm:
If the current behavior is a bug, please provide the steps to reproduce.
Do you want to request a feature or report a bug? bug
What is the current behavior? We recently switched from installing only
dependencies
to a flow wheredevDependencies
are also installed, the build steps run, and then thedevDependencies
are pruned out for users on Heroku.The commands we use for Yarn are here: https://github.com/heroku/heroku-buildpack-nodejs/blob/master/lib/dependencies.sh#L88-L115
but the short version is that we install dependencies with this command:
and then prune dependencies with this command, which is based on this issue
My understanding is that we must ignore scripts in this case, because many of our users define their build step in a
postinstall
script, and this would be re-run.However this additional flag also invalidates the integrity check, which causes a lot of extra work including rebuilds of native dependencies. We can see in our metrics that pruning with Yarn takes several times as long as pruning with npm:
If the current behavior is a bug, please provide the steps to reproduce.
@edmorley dug into this in this comment
Even when
NODE_ENV=production
for both steps, instead of a no-op, we get a rebuild.STR:
git clone https://github.com/mozilla/treeherder && cd treeherder
export NODE_ENV=production
yarn install --production=true --frozen-lockfile --ignore-engines
(this is what's run whenYARN_PRODUCTION=true
)cp node_modules/.yarn-integrity ./.yarn-integrity-original
yarn install --frozen-lockfile --ignore-engines --ignore-scripts --prefer-offline
(what's run for the prune)diff -U3 .yarn-integrity-original node_modules/.yarn-integrity
Expected:
Actual:
What is the expected behavior? In the above repro, I would expect the second invocation to be a noop.
In the case where
devDependencies
must be removed I would expect Yarn to not re-build native dependencies.Please mention your node.js, yarn and operating system version.
This is running on Heroku, which is a modern version of Ubuntu, currently either 14.04 (legacy) or 16.04, with a new version coming in a few months.
The Node version depends on what the customer specifies. Most of our users do not specify a version of Yarn and automatically get the latest version.
Likely related to https://github.com/yarnpkg/yarn/issues/932