Skip to content
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

Does yarn add --ignore-optional work? #2680

Closed
kumarharsh opened this issue Feb 10, 2017 · 15 comments
Closed

Does yarn add --ignore-optional work? #2680

kumarharsh opened this issue Feb 10, 2017 · 15 comments

Comments

@kumarharsh
Copy link

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

What is the current behavior?
Even after specifying the --ignore-optional flag on yarn add, it tries to install optional dependency.

If the current behavior is a bug, please provide the steps to reproduce.
(under windows)
mkdir test && cd test
npm init -y
yarn add paper --ignore-optional

What is the expected behavior?
Yarn shouldn't warn about installing the optional canvas dependency, when I don't have the tools to build it.

Please mention your node.js, yarn and operating system version.
Node: 6.9.2
Yarn: 0.19.1
Windows 10 Home 64bit

@ianks
Copy link

ianks commented Apr 5, 2017

I am experiencing this same issue. No errors are thrown, and the optional dependencies are still installed and added to yarn.lock.

@OmgImAlexis
Copy link

Isn't the flag --no-optional?

@kumarharsh
Copy link
Author

yarn add --help gives me:

image

@OmgImAlexis
Copy link

I think that may be wrong since the docs on the site state it's --no-optional and that's the flag npm uses.

@kumarharsh
Copy link
Author

Actually, I can't even find the word optional on the website docs here: https://yarnpkg.com/en/docs/cli/install#search. Plus, there is no entry for no-optional in the yarn help command.

@bestander
Copy link
Member

merging into #2666

@timrs2998
Copy link

timrs2998 commented Oct 5, 2017

This is still an issue with yarn v1.1.0, running yarn add --help | grep opt I see:

    --ignore-optional                   ignore optional dependencies
    -O, --optional                      save package to your `optionalDependencies`

I can find it in the CLI help documentation, but not the yarn website docs. When I do:

yarn add --ignore-optional bunyan@1.8.3
yarn why dtrace-provider

I can verify that the optional dtrace-provider dependency is installed anyways. As a result, I can't ignore optional dependencies for a specific package.

@davidjb
Copy link

davidjb commented Oct 16, 2017

Like @timrs2998, I'm seeing the same issue on yarn 1.2.1 (Mac, 10.13). Comments added to #4665.

@vleandersson
Copy link

--ignore-optional works in yarn 1.15.2 on MacBookPro12,1 with node 11.13.0

@RodrigoMattosoSilveira
Copy link

RodrigoMattosoSilveira commented Jun 28, 2019

--ignore-optional does not work in yarn 1.15.2 on MacBookPro 10.14.5 with node 11.13.0

$ yarn install --ignore-optional
yarn install v1.15.2
[1/4] 🔍 Resolving packages...
error Package "" refers to a non-existing file '"/Users/rodrigosilveira/projects/rms-sparklines/dist/rmstek-sparklines"'.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
rodrigosilveira@Rodrigos-MacBook-Air[/projects/rms-sparklines]
$ node --version
v11.13.0
rodrigosilveira@Rodrigos-MacBook-Air[
/projects/rms-sparklines]

@jkassis
Copy link

jkassis commented Nov 5, 2020

does not work...

[I] jkassis@Jeremys-MBP ~/c/m/a/s/code (wip)> yarn add --ignore-optional rrule                                                                 11.05 07:18
yarn add v1.22.4
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
[3/5] 🚚  Fetching packages...
[4/5] 🔗  Linking dependencies...
[5/5] 🔨  Building fresh packages...
success Saved lockfile.
success Saved 3 new dependencies.
info Direct dependencies
└─ rrule@2.6.6
info All dependencies
├─ luxon@1.25.0
├─ rrule@2.6.6
└─ tslib@1.14.1
✨  Done in 0.95s.

@taoning2014
Copy link

OMG, this is still broken...

@niftyminer
Copy link

Why is this issue closed? As far as I can tell, --ignore-optional is still ignored...

@lucasgadams
Copy link

This seems like it still doesnt work?

@astorije
Copy link

astorije commented Jun 2, 2023

As far as I can tell, it seems like yarn install --ignore-optional works (for direct dependencies), but yarn add --ignore-optional does not (on v1.22.19).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests