<br />
What could be the reason for this?
<br />
When a package is installed using:<br />
yarn add <package> --dev<br />
it is placed under the "devDependencies" section of package.json. ________________________________________ Behavior of Production Mode<br />
<br />
Node.js uses the environment variable:<br />
NODE_ENV=production<br />
<br />
When this environment variable is set to production, both npm and Yarn follow the standard Node.js convention and skip installing devDependencies. This is done to optimize production builds and reduce deployment size. This is a known and documented behavior in Node.js package management tools.<br />
<br />
Therefore, if: The developer added the date-manipulation library as a dev dependency, and Other team members execute yarn in an environment where NODE_ENV=production is set, then Yarn will not install that dependency because devDependencies are intentionally excluded in production mode. This explains the behavior described in the question. ________________________________________<br />
<br />
Why the Other Options Are Incorrect<br />
<br />
Option A: "YARN_ENV is set to production" is incorrect because Yarn does not use the variable YARN_ENV for dependency installation behavior. Node.js tools use NODE_ENV, not YARN_ENV.<br />
<br />
Option B: This is incorrect because Yarn automatically writes dependencies into package.json. Unlike older<br />
npm versions, there is no need for the --save flag.<br />
<br />
Option D:<br />
<br />
There is no such option as --add. The correct syntax is simply:<br />
yarn add <package> Missing an option that does not exist cannot be the cause. ________________________________________ JavaScript Knowledge Reference (Text-Based, No Links) Node.js uses the environment variable NODE_ENV to determine production or development mode.<br />
Package managers (npm and Yarn) follow the rule that when NODE_ENV=production, only<br />
"dependencies" are installed and "devDependencies" are skipped.<br />
Yarn automatically persists installed packages to package.json without requiring --save.<br />
Yarn uses the command yarn add to add dependencies; there is no --add flag.