Skip to content

Dependency links with version union ("1.0 || 2.0") resolves to 404 page #1120

Description

@alex-key

Links on dependenices with version union (defined with OR operator like 1.0 || 2.0 || 3.0) lead to 404 page.

Example page: https://npmx.dev/package/@ngxi/unjs (see "Peer Dependency" section on the right). Clicking on version lands on https://npmx.dev/package/@angular/core/v/%5E18.0.0%20%7C%7C%20%5E19.0.0%20%7C%7C%20%5E20.0.0


UPDATED

@danielroe clarified that app now should handle complex version ok (it was implemented in #103).

Actual problem is versions has spaces, which should be removed in the URL
1 || 2 => 1||2 => https://npmx.dev/package/nitro/v/1%7C%7C2

NOTE! It seems like Range version with hyphen is not supported: 1-2 => Error 404

Example: https://npmx.dev/package/vite/v/%5E7%7C%7C%5E8%7C%7C%3E=8.0.0-0 works just fine

Image Image

Activity

  1. alex-key commented on Feb 6, 2026

    @alex-key
    ContributorAuthor

    I will work on the fix

  2. added theissue type on Feb 7, 2026
  3. added this to the Alpha announcement milestone on Feb 27, 2026
  4. serhalp commented on Feb 27, 2026

    @serhalp
    Member

    💭 I actually just had an idea for an alternative, simpler solution with a better UX (potentially), that also happens to unlock a simple solution to #1416. I'm working on a PR 👀.

  5. added a commit that references this issue on Feb 27, 2026
    c045062
  6. alex-key commented on Mar 2, 2026

    @alex-key
    ContributorAuthor

    @serhalp Hi Philippe. Do you think you will able to merge #1723 before tomorrow? Otherwise, maybe it worth to merge this as a hotfix and later it could be overwritten by your feature. Thanks!

  7. alex-key commented on Mar 3, 2026

    @alex-key
    ContributorAuthor

    #1874 resolves just part of the issues. But there are still multiple cases which results in error 404.

    The app is relying on a third-party service (by @antfu) which is resolving complex semver expressions into a single max version.
    See app/composables/npm/useResolvedVersion.ts

    But it is not handling many valid cases, which results in 404 on npmx. Examples:

    Union version works with ||

    https://npm.antfu.dev/nuxt@2%7C%7C%3C4

    {"name":"nuxt","specifier":"2||<4","version":"3.21.1","publishedAt":"2026-02-07T16:36:10.454Z","lastSynced":1772535242667}
    

    But fails with valid Range version (w/o ||)

    https://npm.antfu.dev/nuxt@%3E2%3C4

    {
      "error": true,
      "url": "https://npm.antfu.dev/nuxt@%3E2%3C4",
      "statusCode": 400,
      "statusMessage": "Server Error",
      "message": "Invalid tag name \">2<4\" of package \"nuxt@>2<4\": Tags may not have any characters that encodeURIComponent encodes."
    }
    

    Range version with hyphen does not work
    https://npm.antfu.dev/internmap@1-2

    {
      "error": true,
      "url": "https://npm.antfu.dev/internmap@1-2",
      "statusCode": 400,
      "statusMessage": "Server Error",
      "message": "Cannot read properties of undefined (reading 'time')"
    }
    

    Taken from: https://npmx.dev/package/d3-array

    Image
  8. alex-key commented on Mar 3, 2026

    @alex-key
    ContributorAuthor

    @antfu Is this a valid issue in https://github.com/antfu/fast-npm-meta ? Or am I missing something?

  9. alex-key commented on Mar 3, 2026

    @alex-key
    ContributorAuthor

    @danielroe When you have time please see my comment above and advise: should I open another issue for described cases or just re-open this one. Thanks!

  10. antfu commented on Mar 4, 2026

    @antfu
    Collaborator

    @alex-key would be great if you want to work on it and made a PR to fast-npm-meta, thanks!

  11. alex-key commented on Mar 4, 2026

    @alex-key
    ContributorAuthor

    @alex-key would be great if you want to work on it and made a PR to fast-npm-meta, thanks!

    Thank you for the confirmation. I will work on the fix

  12. alex-key commented on Mar 4, 2026

    @alex-key
    ContributorAuthor

    Root case for this resolved in antfu/fast-npm-meta#32

    After investigation I've found that version resolution should work with spaces, so hotfix impemented in #1874 could be reverted.
    But only after https://npm.antfu.dev is updated

  13. added a commit that references this issue on Apr 8, 2026
    a45ad65
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

frontFrontend, Designp2Priority 2 bug (medium)

Type

Projects

  • Status
    Released

Relationships

None yet

Development

No branches or pull requests

Issue actions