This repository has been archived by the owner on Aug 11, 2022. It is now read-only.
CLI flag --only
is overridden by NODE_ENV
#9463
Labels
--only
is overridden by NODE_ENV
#9463
Background
Here's my understanding of how this new feature should work: npm@3.3.0 includes a new CLI flag
--only={prod[uction]|dev[elopment]}
. When this flag is used, only thedependencies
ordevDependencies
listed in package.json should be installed (anddevDependencies
will not be installed recursively 👍 ).This behavior was arrived at in issue #9024.
Here is what the docs say about the
--only
flag:Problem
Using the
--only=dev
flag whenNODE_ENV
is set to production, only the non-devDependencies are installed.Solution(s):
Just some ideas for more intuitive behavior (in order of preference):
--only
flag trumps the environment variable (haven't looked at how this could be implemented).--only
flag is used whenNODE_ENV === 'production'
display a warning, or exit with error.NODE_ENV
trumps the--only
flag.Test-case
Use this package.json:
Test
--only
behavior withNODE_ENV
as development (works as expected):Delete node_modules, and re-test with
NODE_ENV
as production:Expected output
Actual output
The text was updated successfully, but these errors were encountered: