'Is there a way to detect if you have permissions to publish via npm before attempting an actual publish?

I would like to detect if I have permissions to run npm publish without actually doing a publish. I tried npm publish --dry-run, but it runs successfully even if I don't have permissions. It looks like that's only useful to show what the tarball would look like.

Is there a way to do a permission check as well?

npm


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source