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

Default latest version in case it is not sent by the npm registry #6454

Merged
merged 2 commits into from
Oct 2, 2018

Conversation

mad-mike
Copy link
Contributor

@mad-mike mad-mike commented Sep 30, 2018

Summary

Like others before me (#5955), I have the problem that yarn outdated and yarn upgrade-interactive fail with the following error message:

> yarn outdated

yarn outdated v1.10.1
error An unexpected error occurred: "Invalid Version: undefined".
info If you think this is a bug, please open a bug report with the information provided in "yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/outdated for documentation about this command.

  TypeError: Invalid Version: undefined
      at new SemVer (C:\Users\***\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:2549:11)
      at compare (C:\Users\***\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:2836:39)
      at Function.lt (C:\Users\***\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:2870:10)
      at isDepOld (C:\Users\***\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:34115:134)
      at Array.filter (<anonymous>)
      at Function.<anonymous> (C:\Users\***\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:34120:19)
      at Generator.next (<anonymous>)
      at step (C:\Users\***\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:98:30)
      at C:\Users\***\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:109:13
      at <anonymous>

The previous pull request (#6017) appears to have stalled, so I'm trying a different approach.

I'm proposing to assume that the package is up to date if there is no information about a later package in that npm repository.
This is assuming that there is only a temporary issue with the metadata of that package, which will be fixed by the registry at a later point.
Meanwhile it is better to ignore this package than to crash.

Test plan

I tested the change locally by modifying the yarn code and running yarn outdated / yarn upgrade-interactive on a package that depends on a package for which the registry has no latest tag. That registry is a private one at my workplace.
Additionally, I wrote a unit test based on the package metadata in my scenario.

@mad-mike mad-mike force-pushed the fix-crash-on-missing-latest-tag branch from d279a81 to 001d8f5 Compare September 30, 2018 19:00
@mad-mike mad-mike force-pushed the fix-crash-on-missing-latest-tag branch from 001d8f5 to 16965c5 Compare September 30, 2018 19:04
@arcanis arcanis merged commit c62854c into yarnpkg:master Oct 2, 2018
@arcanis
Copy link
Member

arcanis commented Oct 2, 2018

Thanks!

@edmorley
Copy link
Contributor

edmorley commented Oct 2, 2018

CI on master is failing after this merged, with:

 FAIL  __tests__/registries/npm-registry.js
  ● Test suite failed to run

    /root/project/yarn/__tests__/registries/npm-registry.js: Unexpected token, expected , (882:5)
        880 |         },
        881 |       };
      > 882 |     };
            |      ^
        883 | 
        884 |     const result = await npmRegistry.checkOutdated(mockConfig, 'left-pad', '2.0.0');
        885 | 

@arcanis
Copy link
Member

arcanis commented Oct 2, 2018

Yep, I introduced a bug when resolving a conflict. Fixing it atm.

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Nov 22, 2018
Changelog tracks back up to 1.12.0 only.

## 1.12.3

**Important:** This release contains a cache bump. It will cause the very first install following the upgrade to take slightly more time, especially if you don't use the [Offline Mirror](https://yarnpkg.com/blog/2016/11/24/offline-mirror/) feature. After that everything will be back to normal.

- Fixes an issue with `yarn audit` when using workspaces

  [6625](yarnpkg/yarn#6639) - [**Jeff Valore**](https://twitter.com/codingwithspike)

- Uses `NODE_OPTIONS` to instruct Node to load the PnP hook, instead of raw CLI arguments

  **Caveat:** This change might cause issues for PnP users having a space inside their cwd (cf [nodejs/node24065](nodejs/node#24065))

  [6479](yarnpkg/yarn#6629) - [**Maël Nison**](https://twitter.com/arcanis)

- Fixes Gulp when used with Plug'n'Play

  [6623](yarnpkg/yarn#6623) - [**Maël Nison**](https://twitter.com/arcanis)

- Fixes an issue with `yarn audit` when the root package was missing a name

  [6611](yarnpkg/yarn#6611) - [**Jack Zhao**](https://github.com/bugzpodder)

- Fixes an issue with `yarn audit` when a package was depending on an empty range

  [6611](yarnpkg/yarn#6611) - [**Jack Zhao**](https://github.com/bugzpodder)

- Fixes an issue with how symlinks are setup into the cache on Windows

  [6621](yarnpkg/yarn#6621) - [**Yoad Snapir**](https://github.com/yoadsn)

- Upgrades `inquirer`, fixing `upgrade-interactive` for users using both Node 10 and Windows

  [6635](yarnpkg/yarn#6635) - [**Philipp Feigl**](https://github.com/pfeigl)

- Exposes the path to the PnP file using `require.resolve('pnpapi')`

  [6643](yarnpkg/yarn#6643) - [**Maël Nison**](https://twitter.com/arcanis)

## 1.12.2

This release doesn't actually exists and was caused by a quirk in our systems.

## 1.12.1

- Ensures the engine check is ran before showing the UI for `upgrade-interactive`

  [6536](yarnpkg/yarn#6536) - [**Orta Therox**](https://github.com/orta)

- Restores Node v4 support by downgrading `cli-table3`

  [6535](yarnpkg/yarn#6535) - [**Mark Stacey**](https://github.com/Gudahtt)

- Prevents infinite loop when parsing corrupted lockfiles with unterminated strings

  [4965](yarnpkg/yarn#4965) - [**Ryan Hendrickson**](https://github.com/rhendric)

- Environment variables now have to **start** with `YARN_` (instead of just contain it) to be considered

  [6518](yarnpkg/yarn#6518) - [**Michael Gmelin**](https://blog.grem.de)

- Fixes the `extensions` option when used by `resolveRequest`

  [6479](yarnpkg/yarn#6479) - [**Maël Nison**](https://twitter.com/arcanis)

- Fixes handling of empty string entries for `bin` in package.json

  [6515](yarnpkg/yarn#6515) - [**Ryan Burrows**](https://github.com/rhburrows)

- Adds support for basic auth for registries with paths, such as artifactory

  [5322](yarnpkg/yarn#5322) - [**Karolis Narkevicius**](https://twitter.com/KidkArolis)

- Adds 2FA (Two Factor Authentication) support to publish & alike

  [6555](yarnpkg/yarn#6555) - [**Krzysztof Zbudniewek**](https://github.com/neonowy)

- Fixes how the `files` property is interpreted to bring it in line with npm

  [6562](yarnpkg/yarn#6562) - [**Bertrand Marron**](https://github.com/tusbar)

- Fixes Yarn invocations on Darwin when the `yarn` binary was symlinked

  [6568](yarnpkg/yarn#6568) - [**Hidde Boomsma**](https://github.com/hboomsma)

- Fixes `require.resolve` when used together with the `paths` option

  [6565](yarnpkg/yarn#6565) - [**Maël Nison**](https://twitter.com/arcanis)

## 1.12.0

- Adds initial support for PnP on Windows

  [6447](yarnpkg/yarn#6447) - [**John-David Dalton**](https://twitter.com/jdalton)

- Adds `yarn audit` (and the `--audit` flag for all installs)

  [6409](yarnpkg/yarn#6409) - [**Jeff Valore**](https://github.com/rally25rs)

- Adds a special logic to PnP for ESLint compatibility (temporary, until [eslint/eslint10125](eslint/eslint#10125) is fixed)

  [6449](yarnpkg/yarn#6449) - [**Maël Nison**](https://twitter.com/arcanis)

- Makes the PnP hook inject a `process.versions.pnp` variable when setup (equals to `VERSIONS.std`)

  [6464](yarnpkg/yarn#6464) - [**Maël Nison**](https://twitter.com/arcanis)

- Disables by default (configurable) the automatic migration of the `integrity` field. **It will be re-enabled in 2.0.**

  [6465](yarnpkg/yarn#6465) - [**Maël Nison**](https://twitter.com/arcanis)

- Fixes the display name of the faulty package when the NPM registry returns corrupted data

  [6455](yarnpkg/yarn#6455) - [**Grey Baker**](https://github.com/greysteil)

- Prevents crashes when running `yarn outdated` and the NPM registry forgets to return the `latest` tag

  [6454](yarnpkg/yarn#6454) - [**mad-mike**](https://github.com/mad-mike)

- Fixes `yarn run` when used together with workspaces and PnP

  [6444](yarnpkg/yarn#6444) - [**Maël Nison**](https://twitter.com/arcanis)

- Fixes an edge case when peer dependencies were resolved multiple levels deep (`webpack-dev-server`)

  [6443](yarnpkg/yarn#6443) - [**Maël Nison**](https://twitter.com/arcanis)
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.

3 participants