After installing Nexus Repository Manager OSS version 3.2.1, I successfully ran it on my local machine.
Setup
Within Nexus, I have set up three NPM repositories:
- [PUBLIC] - acting as a proxy for the public npm registry
- [PRIVATE] - designated for my own packages and as a private repository
- [NPM] - a group repository that grants access to [PRIVATE] and [PUBLIC] in that specific order
In the Settings/Security/Realms section, I made sure to add npm Bearer Token Realm for security purposes.
Downloading Packages
Downloading packages from [PUBLIC] repository is functioning smoothly as intended.
.npmrc
registry=http://localhost:8081/repository/PUBLIC
npm install react // Successfully downloading from [PUBLIC]
I can also download packages from the [NPM] repository without any issues.
.npmrc
registry=http://localhost:8081/repository/NPM
npm install react // Works fine, downloads from [PUBLIC]
However, I encountered a problem with the [PRIVATE] repository as I do not have a package named "react" in it.
Publishing Packages
When it comes to publishing, I prefer not to publish to [PUBLIC] repository.
I have successfully published packages to the [PRIVATE] repository.
.npmrc
registry=http://localhost:8081/repository/PRIVATE
npm publish // Successfully publishes to [PRIVATE]
Interestingly, I am unable to publish packages to the [NPM] repository which seems unusual.
.npmrc
registry=http://localhost:8081/repository/NPM
npm publish // Fails to publish, should go to [PRIVATE] instead
// Returns HTTP 400 error
Error Details
For a detailed log of the error, refer to: https://pastebin.com/5GuqNNhf
Issue
While I am aware that I can configure a different URL for publishing packages using 'publishConfig' in the package.json file, it feels redundant to me in terms of configuration.
Is there a way to achieve this using the Nexus group repository?