I am trying to use a private npm
registry for my nodejs projects and I am using nexus for that matter. I kept admin
user to be used, at least for testing and to guarantee there's no permission issue. However, I can login neither publish using npm login --registry <private-registry-address>
and npm publish --registry <private-registry-address>
receptively. I used several methods, first I manually added entries in .npmrc
file as follows:
This one is mentioned in Nexus 3 docs:
➜ echo "email=$NPM_EMAIL" > $HOME/.npmrc
➜ echo "_auth=$(echo -n "$NPM_USER:$NPM_PASS" | openssl base64)" >> $HOME/.npmrc
➜ echo "always-auth=true" >> $HOME/.npmrc
Then I try to publish using npm publish --registry http://172.17.0.1:8081/repository/npmtest/
, but it just gives me:
npm ERR! code E400
npm ERR! 400 Bad Request - PUT http://172.17.0.1:8081/repository/npmtest/mypackage
This one is kind of the official in npm docs:
Here, I log in the repo using the credentials I have as follows:
➜ npm login --registry http://172.17.0.1:8081/repository/npmtest/
and enter my login creds:
Username: admin
Password:
Email: (this IS public) [email protected]
But unfortunately, it gives me the same exact error:
npm ERR! code E400
npm ERR! 400 Bad Request - PUT http://localhost:8081/repository/npmtest/-/user/org.couchdb.user:admin
I have added npm Bearer Token Realm
in Nexus as I saw in many discussions and it didn't make a difference as well.
I have tried to use another repo verdaccio
and it worked normally, that's why I am pretty sure this is a nexus issue.
Note: I am using all repo managers (Nexus and verdaccio) as docker containers, anyway this should not be an issue.
I am running npm
version 6.10
What could be a solution here for nexus to work?
{
...,
"publishConfig": {
"registry": "<linkToNexusRepo>"
}
}
Resolve the issue for me by adding this snipped in my package.json
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With