Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy failing due to the switch to Yarn and not installing devDependencies #356

Closed
bjeanes opened this issue Dec 19, 2016 · 9 comments
Closed

Comments

@bjeanes
Copy link

bjeanes commented Dec 19, 2016

We rely on installing devDependencies to run a Webpack build during slug compilation.

Since a few days ago, all pushes are failing now with missing module exceptions but further up the build log the following appears:

Warning: when NODE_ENV=production, yarn will NOT install any devDependencies
(even if NPM_CONFIG_PRODUCTION is false)
https://yarnpkg.com/en/docs/cli/install#toc-yarn-install-production

I tried setting YARN_PRODUCTION=false too, just in case that has an effect, but it did not. This feels like a break change, even if I appreciate the push to support Yarn (as I use it locally with great joy).

Is there an advised course of action here other than somehow filtering out yarn.lock from the slug?

This might be a dupe of #350, but my behaviour is different in that it doesn't blow up when installing deps, just when trying to use them in heroku-postbuild script.

@bjeanes
Copy link
Author

bjeanes commented Dec 19, 2016

https://devcenter.heroku.com/articles/nodejs-support#devdependencies should probably be updated to reflect that Yarn does not honour NPM_CONFIG_PRODUCTION and that instead you may need to set NODE_ENV.

For now, I've added yarn.lock to my .slugignore file so that the buildpack goes back to using NPM for now, even though I would prefer the determinism of Yarn here.

@hunterloftis
Copy link
Contributor

Hey @bjeanes! Yarn now supports YARN_PRODUCTION (an analogue to NPM_CONFIG_PRODUCTION), so in the next release I'll map one to the other so their behavior will be equivalent, at least on Heroku.

@hunterloftis
Copy link
Contributor

#359

@wyattjoh
Copy link

@hunterloftis does the YARN_PRODUCTION affect the NODE_ENV as well?

My use case is I have devDependencies that include static asset requirements that are a part of the postinstall hook, but these dependencies aren't needed while the app is running, only during the build step. Any thoughts?

@itaysabato
Copy link

This issue will in fact only be resolved in the next release of yarn (current is 0.18.1), which this PR should be a part of.

@RavenHursT
Copy link

@hunterloftis this still seems to be happening. I've set:

YARN_PRODUCTION=false
NPM_CONFIG_PRODUCTION=false
NODE_ENV=development

And when I try to build and deploy a "review" environement I still get ./node_modules/.bin/babel: not found. Which tells me that my devDependencies are still not getting installed before npm run build (which is running babel for transpilation) runs.

How can we accomplish this other than just dumping all devDependencies under dependencies (which doesn't make sense because things like babel are not required for the app to run, just to build)?

@RavenHursT
Copy link

ok.. odd.. on the same "review" environment config, I have the "parent app" set to my staging environment config. I assumed that would mean that it would "inherit" it's config vairables from that app where I have the following set:

YARN_PRODUCTION=false
NPM_CONFIG_PRODUCTION=false
NODE_ENV=development

But if I go into the app (after it's failed to build) and view "settings" and "reveal config vars", the only value set there is NODE_ENV=development

All the rest aren't there. Am I wrong in how I'm attempting to accomplish this? How do we set config vars for "review" apps??

@jmorrell
Copy link
Contributor

@RavenHursT You can define env variables for review apps in app.json: https://devcenter.heroku.com/articles/github-integration-review-apps#inheriting-config-vars

If you're having difficulty please open a ticket at https://help.heroku.com/, and we'll get it sorted :)

@RavenHursT
Copy link

Thanks for responding @jmorrell... I just got it working by doing, just that. I think the problem was the UI in Heroku, when enabling review apps says to "inherit config vars from:"... and you choose the env in your pipeline you want that to happen with. There's nothing there, informing the user that the app.json for the given app must have those var names referenced in order for that to take place. Hence the confusion. Took me an hour or two of googling to find this: https://devcenter.heroku.com/articles/github-integration-review-apps#inheriting-config-vars

Might be good to make that clearer in the Heroku UI... ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants