Skip to content

[Bug?]: Cannot publish a yarn pack #7062

@vinils

Description

@vinils

Self-service

  • I'd be willing to implement a fix

Describe the bug

Running "yarn pack" command outputs package.tgz file which cannot be published by "yarn npm publish" (v2) or "yarn publish" (v1) because there is not option to specify package file path.

"npm publish" cli accepts package file path especification

To reproduce

  • Berry 4.11.0 version
    1- find any publishable project
    2- pack it using yarn pack
    3- Try publish it using: yarn npm publish ./package.tgz
  • Actual result:
    Unknown Syntax Error: Extraneous positional argument ("./package.tgz").

$ yarn npm publish [--access #0] [--tag #0] [--tolerate-republish] [--otp #0] [--provenance] [-n,--dry-run] [--json]

  • Expected result
    as npm publish should be possible to especify package.tgz file and publish it
  • v1 1.22.22
    1- find any publishable project
    2- pack it using yarn pack
    3- Try publish it using: yarn publish package.tgz
  • Actual result:
    yarn publish v1.22.22
    error Couldn't find a package.json file in "C:\Users\myuser\source\repos"
    info Visit https://yarnpkg.com/en/docs/cli/publish for documentation about this command.

$ yarn npm publish [--access #0] [--tag #0] [--tolerate-republish] [--otp #0] [--provenance] [-n,--dry-run] [--json]

  • Expected result
    as npm publish should be possible to especify package.tgz file and publish it

Environment

System:
    OS: Windows 11 10.0.26200
    CPU: (8) x64 Intel(R) Core(TM) Ultra 7 256V
  Binaries:
    Node: 22.22.0 - C:\Users\myuser\AppData\Local\Temp\xfs-c83e24ce\node.CMD
    Yarn: 4.11.0 - C:\Users\myuser\AppData\Local\Temp\xfs-c83e24ce\yarn.CMD
    npm: 10.9.4 - C:\nvm4w\nodejs\npm.CMD
  npmPackages:
    jest: ^29.7.0 => 29.7.0

Additional context

Not being able to pulish a package file makes yarn pack cmd not meaningful
npm publish cli make possible to publish it and would be nice to do the same and be compatible with it
its also a good pratice for CI to separete build machine from deploy machine which is not possible without package files

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