yarn icon indicating copy to clipboard operation
yarn copied to clipboard

`yarn install -force` succeeds ignorning `-force`. Should be `--force`

Open HaleTom opened this issue 9 years ago • 4 comments

Bug report

What is the current behavior?

yarn install -force doesn't output an error message about an invalid argument. It should be yarn install --force with two - characters.

$ yarn install -force
yarn install v1.1.0
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.36s.

Compare with the desired:

$ yarn install --force
yarn install v1.1.0
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Rebuilding all packages...
success Saved lockfile.
Done in 3.48s.
$ 

What is the expected behavior? An error message such as:

yarn: unrecognised command line argument "-force". See `yarn help install`

Versions

$ node --version
v8.5.0
$ yarn --version
1.1.0
$ uname -a
Linux svelte 4.9.51-1-MANJARO #1 SMP PREEMPT Wed Sep 20 10:37:40 UTC 2017 x86_64 GNU/Linux

HaleTom avatar Oct 08 '17 07:10 HaleTom

Will try to create a pull request that fixes this and submit next week.

joaoptpsa avatar Nov 10 '17 12:11 joaoptpsa

Is it really suposed to output a error message ?

joaoptpsa avatar Nov 16 '17 17:11 joaoptpsa

seems like it should be at least a warning, the flag does nothing without two dashes.

worc avatar Sep 11 '18 21:09 worc

Closing as fixed in v2, where flags are validated much more carefully.

https://yarnpkg.com/getting-started/migration

paul-soporan avatar Jan 02 '21 22:01 paul-soporan