NPM Registry Doesn't work with Yarn

Summary

Yarn requires that package registries return dist-tags as well as versions, but the package repository doesn't return dist-tags.

Steps to reproduce

  1. Enable Package Repositories
  2. Publish a package to your GitLab repository
  3. Attempt to use yarn (1.13.0) to install package (specifying the version)

Example Project

Any package will cause the issue.

What is the current bug behavior?

yarn errors out due to https://github.com/yarnpkg/yarn/blob/v1.13.0/src/resolvers/registries/npm-resolver.js#L43

What is the expected correct behavior?

GitLab could do one or better:

  1. At least return an empty dist-tags to be a standard response
  2. GitLab should at least support the @Latest flag (mapping it to the latest version)
  3. GitLab should support adding and removing tags: https://docs.npmjs.com/cli/dist-tag

Output of checks

This bug happens on GitLab.com

Possible fixes

The presenter could be easily modified for potential correct behavior 1 or 2: https://gitlab.com/gitlab-org/gitlab-ee/blob/master/ee/app/presenters/npm_package_presenter.rb

Secondary Notes

Not supporting the @Latest flag in the npm package repository does mean that the npm repository can only be used when specifying the version in the add command. It would be really nice for that to work.

Assignee Loading
Time tracking Loading