yarn icon indicating copy to clipboard operation
yarn copied to clipboard

Dependency is missing when using yarn --ignore-optional

Open acuper opened this issue 8 years ago • 3 comments

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

What is the current behavior?

yarn --ignore-optional doesn't install all (none optional) dependencies

Related to https://github.com/yarnpkg/yarn/pull/4448

Steps to reproduce: package.json: { "dependencies": { "some-package": "^4.1.0", "yargs": "^9.0.1" } }

now some-package has this as optionalDependency: "yargs": "^7.0.2"

the result of yarn --ignore-optional is missing package: is-fullwidth-code-point which dependency path is: yargs -> string-width -> is-fullwidth-code-point

Tested on: node 6.11.2 yarn 1.3.2

acuper avatar Dec 07 '17 15:12 acuper

hey @acuper thanks for the issue! Would you mind sharing what some-package is or creating a sample repo so we can get reproducible steps to verify the bug? Thanks!

kaylie-alexa avatar Dec 07 '17 21:12 kaylie-alexa

I can reproduce this with https://github.com/spalger/reproduce-issues/blob/master/yarn-ignores-non-optional-dependencies/package.json

running yarn installs:

node_modules/path-is-absolute/package.json
node_modules/rimraf/package.json
node_modules/balanced-match/package.json
node_modules/moment/package.json
node_modules/safe-json-stringify/package.json
node_modules/ncp/package.json
node_modules/once/package.json
node_modules/nan/tools/package.json
node_modules/nan/package.json
node_modules/inherits/package.json
node_modules/bunyan/package.json
node_modules/minimist/package.json
node_modules/brace-expansion/package.json
node_modules/minimatch/package.json
node_modules/dtrace-provider/package.json
node_modules/concat-map/package.json
node_modules/mv/package.json
node_modules/glob/package.json
node_modules/wrappy/package.json
node_modules/mkdirp/package.json
node_modules/inflight/package.json

but yarn --ignore-optional installs:

node_modules/once/package.json
node_modules/bunyan/package.json

Even though once/package.json includes

{
  "name": "once",
  "version": "1.4.0",
  "description": "Run a function exactly one time",
  "main": "once.js",
  "directories": {
    "test": "test"
  },
  "dependencies": {
    "wrappy": "1"
  },

spalger avatar Dec 08 '17 06:12 spalger

@kaylieEB I took @spalger's reproduction and added a failing test in yarn: https://github.com/yarnpkg/yarn/pull/5059

kimjoar avatar Dec 08 '17 11:12 kimjoar