Search code examples
javascriptnpm

npm tries to sign me up for private packages when publishing public packages


Edit as requested: per SO guidelines, even though the question isn't duplicate, the answer is the same so we mark it as duplicate, which is fine. However the question here is valid, people will search for the error in this question (You must sign up for private packages) and not search for the other question (unscoped packages cannot be private, which is a different error message), so this question has value and does not deserve to be deleted.

I have a package @myorg/somename that has private set to false. When publishing the package with npm publish I get the error:

npm notice Publishing to https://registry.npmjs.org/ with tag latest and default access
npm ERR! code E402
npm ERR! 402 Payment Required - PUT https://registry.npmjs.org/@myorg%2fsomename - You must sign up for private packages

The package is Open Source, and I explictly wish to publish the package publicly. How can I publish the package?


Solution

  • To publish a scoped package when you first publish it you need to run:

    npm publish --access=public
    

    You will not need to pass --access=public once it's been published thereafter.