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

Can't generate provenance for new or private package, you must set access to public. #27754

Closed
4 tasks
ThePlenkov opened this issue Sep 3, 2024 · 3 comments · Fixed by #27765
Closed
4 tasks

Comments

@ThePlenkov
Copy link
Contributor

Current Behavior

I'm trying to publish a new package via nx release command. I have a following error message in the log:

npm publish error:
Can't generate provenance for new or private package, you must set `access` to public.

When I check documentation it's mentioned that we need to call publish like this:

npm publish --provenance --access public

However in this code we do not consider those flags:

}
    /**
     * NOTE: If this is ever changed away from running the command at the workspace root and pointing at the package root (e.g. back
     * to running from the package root directly), then special attention should be paid to the fact that npm publish will nest its
     * JSON output under the name of the package in that case (and it would need to be handled below).
     */
    const npmPublishCommandSegments = [
        `npm publish "${packageRoot}" --json --"${registryConfigKey}=${registry}" --tag=${tag}`,
    ];
    if (options.otp) {
        npmPublishCommandSegments.push(`--otp=${options.otp}`);
    }
    if (isDryRun) {
        npmPublishCommandSegments.push(`--dry-run`);
    }

Therefore do you think is it possible to introduce a new access parameter for release-publish plugin where we can declare public access? Thanks!

Expected Behavior

nx release should properly care of publishing new public packages from CI/CD

GitHub Repo

No response

Steps to Reproduce

  1. Publish a new public package using nx release CI/CD

Nx Report

ode           : 20.16.0
OS             : linux-x64
Native Target  : x86_64-linux
npm            : 10.8.1

nx (global)        : 19.6.4
nx                 : 19.6.3
@nx/js             : 19.6.3
@nx/jest           : 19.6.3
@nx/linter         : 19.6.3
@nx/eslint         : 19.6.3
@nx/workspace      : 19.6.3
@nx/devkit         : 19.6.3
@nx/eslint-plugin  : 19.6.3
@nx/plugin         : 19.6.3
@nx/rollup         : 19.6.3
@nrwl/tao          : 19.6.3
@nx/vite           : 19.6.3
@nx/web            : 19.6.3
typescript         : 5.5.4
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/jest/plugin
---------------------------------------
Local workspace plugins:
         workspace-plugin

Failure Logs

No response

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@ThePlenkov
Copy link
Contributor Author

Meanwhile my solution was just simply by using:

NPM_CONFIG_ACCESS: public

@JamesHenry
Copy link
Collaborator

Please see my response here for how to set this in package.json instead of via an environment variable:

#27165 (comment)

Given this is the second time it has come up and the fact that NPM doesn't document this in the context of provenance generation, I will add support for forwarding the argument.

However, I would still recommend using it with caution so as to not apply it to more packages than intended.

Copy link

github-actions bot commented Oct 6, 2024

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants