When trying to push a Node.js project to Heroku, I can find between the log lines the following one:
Pruning devDependencies
remote: Skipping because NPM_CONFIG_PRODUCTION is 'true'
Now, I was expecting pruning is skipped at the opposite condition ( NPM_CONFIG_PRODUCTION=false
).
Any thoughts about?
The default behaviour of Heroku's Node.js buildpack is to install dependencies
and devDependencies
, build the slug, and then strip out the devDependencies
. They'll be available during the build process but not afterwards.
You can direct Heroku to only install dependencies by setting environment variables
NPM_CONFIG_PRODUCTION=true
orYARN_PRODUCTION=true
.
Since devDependencies
are never installed there is no need to prune them. There's nothing to strip out.
(Technically, the buildpack skips pruning if NPM_CONFIG_PRODUCTION
is non-null ; its actual value doesn't matter for this part of the logic.)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.