Currently, I am in the process of setting up a Jenkins and a private npm repository called Sonatype Nexus. I am encountering an error when attempting to publish to the repository within a Jenkins build pipeline.
+ npm publish --registry https://<my-private-registry>/repository/npm-private/
npm notice
npm notice package: <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4531366824262a3036312c263605756b751b75">[email protected]</a>
npm notice === Tarball Contents ===
npm notice 2.4kB Jenkinsfile
...
('notice' level info about the files)
...
npm notice === Tarball Details ===
npm notice name: ts-acoustics
npm notice version: 0.0.0
npm notice package size: 13.8 kB
npm notice unpacked size: 47.5 kB
npm notice shasum: 554b6d2b41321d78e00f6a309bb61c9181a2e3d6
npm notice integrity: sha512-QtExdu6IqZ+lH[...]r+HXolo4YCFPg==
npm notice total files: 17
npm notice
npm ERR! code E403
npm ERR! 403 403 Forbidden - PUT https://<my-private-registry>/repository/npm-private/ts-acoustics
npm ERR! 403 In most cases, you or one of your dependencies are requesting
npm ERR! 403 a package version that is forbidden by your security policy.
No further information is available in the Nexus logs about why this operation is forbidden. I came across this GitHub bug report, indicating that the error message provided may not be accurate most of the time.
Any suggestions on how to proceed to successfully publish the package?
Update 1: Upon manual publishing, I encountered the same issue! Hence, for simplicity reasons, I have ruled out Jenkins as the root cause.
Update 2: I tried npm adduser --registry...
and received the following response from npm:
Logged in as <my-user> on https://<my-private-registry>/repository/npm-private/.
Upon executing npm whoami --registry...
, the correct username is displayed.
However, when I run npm publish --registry...
within the project, the 403 Error persists.