Skip to content

[Bug]: yarn pack with a catalog produces invalid npm aliases #6913

@turadg

Description

@turadg

Self-service

  • I'd be willing to implement a fix

Describe the bug

When Yarn creates a tarball from a package using catalogs, it creates invalid NPM aliases.

To reproduce

  1. define a dependency via catalog
  2. yarn pack to create a tarball
  3. unzip and cd into the package directory
  4. npm install

Expected
Installation

Actual

npm error aliases must have a name

Because the package.json has entries like,

  "@endo/bundle-source": "npm:^4.1.2",
  "@endo/errors": "npm:^1.2.13",
  "@endo/eventual-send": "npm:^1.3.4",

Environment

System:
    OS: macOS 26.0
    CPU: (16) arm64 Apple M4 Max
  Binaries:
    Node: 22.19.0 - /private/var/folders/v2/309w97f90q5d0r47d3np62v40000gn/T/xfs-b5805a45/node
    Yarn: 4.10.1 - /private/var/folders/v2/309w97f90q5d0r47d3np62v40000gn/T/xfs-b5805a45/yarn
    npm: 11.6.0 - ~/.local/state/fnm_multishells/43298_1758308685405/bin/npm

Additional context

I think the solution is to either omit npm: or repeat the package name so it's a valid alias.

See lerna-lite/lerna-lite#1148 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions