npmnpm-package

npm package becomes private every time I publish


I have an npm organization (paid) that has some private packages. This one, however, should be public. It has been private before.

Recently, every time I publish it, it becomes private again, and I have to manually change it to public in their web UI.

I am publishing using this:

(npm version prerelease --preid $BRANCH_NAME && npm run build && npm publish --access public --tag alpha) || read -r -n 1 -p "Press any key to continue"

I do not have "private": true in package.json.

Other packages with identical release scripts work as expected. What could be wrong here?


Solution

  • Turns out I had this in my package.json:

    "publishConfig": {
        "access": "restricted"
    },
    

    This is documented here: https://docs.npmjs.com/cli/v10/using-npm/config#access