Yarn: devDependencies are not installed when both `NODE_ENV=production` and `NPM_CONFIG_PRODUCTION=false` are set

Created on 22 Nov 2016  Â·  5Comments  Â·  Source: yarnpkg/yarn

Do you want to request a feature or report a bug?
bug

What is the current behavior?

NODE_ENV seems to be taking precedence over NPM_CONFIG_PRODUCTION (and YARN_PRODUCTION).

In npm, it's the opposite.

If the current behavior is a bug, please provide the steps to reproduce.

$ yarn init -y
$ yarn add Base64
$ yarn add --dev blob
$ rm -rf node_modules
$ NODE_ENV=production NPM_CONFIG_PRODUCTION=false yarn

This doesn't install blob.

What is the expected behavior?

It should install devDependencies like npm does:

$ yarn init -y
$ yarn add Base64
$ yarn add --dev blob
$ rm -rf node_modules
$ NODE_ENV=production NPM_CONFIG_PRODUCTION=false npm install

This does install blob.

Please mention your node.js, yarn and operating system version.

$ node -v
v6.3.1

$ npm -v
3.10.3

$ yarn -V
0.17.8

Windows 10

cat-compatibility

Most helpful comment

@joeyespo

(and YARN_PRODUCTION)

Is that a real thing? I didn't come across it in any documentation, and Googling for it is nearly impossible due to the articles about yarn production that show up...

All 5 comments

@joeyespo

(and YARN_PRODUCTION)

Is that a real thing? I didn't come across it in any documentation, and Googling for it is nearly impossible due to the articles about yarn production that show up...

@adamreisnz Yeah, it's the same deal with NPM_CONFIG_. It's a prefix that you can use to specify any of the npm options. YARN_ is the Yarn-equivalent, with NPM_CONFIG_ for backwards-compatibility. So it doesn't really show up in any searches. (I figured this out after digging around a while.)

Ok thanks, I'll give it a go. Might be useful for my issue where I want to install only prod dependencies, yet have NODE_ENV set to something else, like staging.

Edit ok it's not useful after all, as it overwrites NODE_ENV to production.

BTW a PR for the docs change is welcome

On Sat, 17 Dec 2016 at 21:02, Adam Reis notifications@github.com wrote:

Ok thanks, I'll give it a go. Might be useful for my issue where I want to
install only prod dependencies, yet have NODE_ENV set to something
else, like staging.

—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/yarnpkg/yarn/issues/1975#issuecomment-267786768, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ACBdWHhSC4nRIHLurCnx3u7WhVaHTCuHks5rJE32gaJpZM4K41NQ
.

This issue is blocking me from migrating to yarn. When can we expect a release including the fix?

Was this page helpful?
0 / 5 - 0 ratings