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

yarn upgrade --latest error for dependency specified with >= #7079

Closed
shilcare opened this issue Mar 4, 2019 · 1 comment · Fixed by #7080
Closed

yarn upgrade --latest error for dependency specified with >= #7079

shilcare opened this issue Mar 4, 2019 · 1 comment · Fixed by #7080

Comments

@shilcare
Copy link
Contributor

shilcare commented Mar 4, 2019

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

What is the current behavior?
When run yarn upgrade --latest --non-interactive --verbose in a project with

package.json:

{
  "name": "test",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "dependencies": {
    "underscore": ">=1.8.3"
  }
}

yarn.lock

underscore@>=1.8.3:
  version "1.8.3"
  resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.8.3.tgz#4f3fb53b106e6097fcf9cb4109f2a5e9bdfa5022"
  integrity sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=
verbose 1.265 Considering upgrade of "underscore" to "underscore@>1.9.1" because a newer version exists in the registry.
verbose 1.27 Not unlocking "underscore@>1.9.1" in the lockfile because it is a new or direct dependency.
[1/4] Resolving packages...
verbose 1.327 Error: Couldn't find any versions for "underscore" that matches ">1.9.1"
    at MessageError.ExtendableBuiltin (C:\Program Files (x86)\Yarn\lib\cli.js:727:66)
    at new MessageError (C:\Program Files (x86)\Yarn\lib\cli.js:756:123)
    at Function.<anonymous> (C:\Program Files (x86)\Yarn\lib\cli.js:49489:13)
    at Generator.next (<anonymous>)
    at step (C:\Program Files (x86)\Yarn\lib\cli.js:304:30)
    at C:\Program Files (x86)\Yarn\lib\cli.js:315:13
error Couldn't find any versions for "underscore" that matches ">1.9.1"

If the current behavior is a bug, please provide the steps to reproduce.
Same as above.

What is the expected behavior?
It should upgrade to "underscore@>=1.9.1"
Please mention your node.js, yarn and operating system version.
node: v11.10.1
yarn: v1.13.0
OS: Windows 10

@shilcare
Copy link
Contributor Author

shilcare commented Mar 4, 2019

I've created a pull request #7080 to fix it.

rally25rs pushed a commit that referenced this issue Mar 5, 2019
**Summary**

Fix bug #7079 of `basicSemverOperatorRegex`. It doesn't match the range operator correctly if the dependency range is specified with `>=`. For example, when running `yarn upgrade --latest`, if a dependency is specified with `>=`, the matched result will be `>`, which is not correct. 

This is because the regular expression engine looks for alternations one-by-one. We can fix it by putting `>=` before `>`.

fixes #7079
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

Successfully merging a pull request may close this issue.

1 participant