Skip to content

Conversation

@kpbl
Copy link

@kpbl kpbl commented Jun 21, 2018

Summary
When a dependency package has no latest tag the commands yarn upgrade and yarn upgrade-interactive will throw the following error:
An unexpected error occurred: "Invalid Version: undefined".

This is because in method getOutdatedPackages of the class PackageRequest latest is undefined when no latest tag is found and the call to semver.lt(current, latest) throws an error.

I simply checked if latest is undefined before the call to semver.lt(current, latest) .

fixes #5955

Test plan
I did not know how to write a test for this because i have found no public package that did not has a latest tag. Any advice would be great.

@arcanis
Copy link
Member

arcanis commented Jun 26, 2018

I did not know how to write a test for this because i have found no public package that did not has a latest tag.

How did it happen? Private registry?

Also, I think the fix would rather be the following (to avoid so that if there is no latest, then the dependency isn't marked as out of date rather than the opposite). What do you think?

const isDepOld = ({current, latest, wanted}) =>
      latest === 'exotic' || (semver.lt(current, wanted) || latest === undefined && semver.lt(current, latest));

Copy link
Member

@arcanis arcanis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cf comment

@arcanis
Copy link
Member

arcanis commented Oct 2, 2018

Fixed with #6454

@arcanis arcanis closed this Oct 2, 2018
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 this pull request may close these issues.

yarn upgrade-interactive fails with Invalid version: undefined error if a dependency has only prerelease versions

2 participants