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
*bug* Yarn will not install devDependencies when NODE_ENV=production #2739
Comments
I don't think this is a bug. As you mentioned, As a side note: if you rely on packages from |
@LINKIWI I've got weird ci configurations that probably need to be refactored. Here's one of them where I run tests (which rely on dev dependencies) with my application in production mode. Would either of my suggestions be welcome? Or if this is something that you believe only I experience, I'll happily close the issue. |
@mldangelo You can install the dev dependencies in |
Good to know about I needed this feature too for CI because I need all the packages to build my project, but webpack (and the |
FYI, I seem to have experienced the opposite behaviour in yarn 0.27.5. When NODE_ENV=production is set, yarn is still installing devDependencies, while npm@5.3.0 is not. |
As mentioned in other comments, this is the intended behavior. The documentation for the
I'm going to mark this issue 'closed' for now, but if you feel there is more to it that needs resolved, let us know and we can re-open it. |
I'm using NODE_ENV=production to produce a "production" build in a CI/CD (docker) environment, so... I need devDependencies installed to produce the build. |
@sir-gon I'm about to help a colleague resolve this same situation. I think I grok the yarn docs cited above; all that should be required is to do Tangent: seems to me with both yarn and npm there's insufficient distinction between "dependencies needed to build the software" and "dependencies needed at runtime". |
I faced the same issue and thank for you explanations. Here is how I circumvent this under Docker environment https://stackoverflow.com/questions/31889867/docker-compose-not-overriding-dockerfile-environment-variables#answer-53705415 |
Thank goodness for this thread. |
Same issue. Good to know. Thanks. |
Thx for this thread! Ran into this issue with docker and it was not very obvious as I migrated from one dockerfile and had quite a lot changed |
This was a very difficult issue to track down, thank you for this thread! |
6 years later and this thread is still saving jobs. |
It´s true, this thread saved my life |
saved me too. But still 1-2 hours lost to debugging :/ |
Current behavior
Currently, when
NODE_ENV=production
, yarn will only install dependencies and not devDependencies. This behavior mirrors npm, but isn't reflected anywhere in yarn's documentation. and there's no flag to force yarn to all dependencies. The ability to force all dependencies to be installed is useful to me for ci testing. My current workaround is to useNODE_ENV=development yarn
.Proposed solutions
yarn install --all
(?)I'm happy to do either or both if pull requests are welcome.
node.js, yarn and operating system version.
The text was updated successfully, but these errors were encountered: