400 bad request when logging/pushing npm package to nexus?
{
...,
"publishConfig": {
"registry": "<linkToNexusRepo>"
}
}
Resolve the issue for me by adding this snipped in my package.json.
Badr
I am a software development holic. I feel myself above the sky and feel that I am superman whenever I write code. Okay, enough with the fantasy :-D. I did my masters thesis in Software Release Management Proces. Currently I am working as DevOps Engineer. I enjoy problem solving, system design, and optimization. Looking forward to learn more in Big Data and Machine Learning. Hope I can get and offer help here. Thanks for reading :-)
Updated on June 23, 2022Comments
-
Badr 5 months
I am trying to use a private
npmregistry for my nodejs projects and I am using nexus for that matter. I keptadminuser to be used, at least for testing and to guarantee there's no permission issue. However, I can login neither publish usingnpm login --registry <private-registry-address>andnpm publish --registry <private-registry-address>receptively. I used several methods, first I manually added entries in.npmrcfile 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/.npmrcThen 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/mypackageThis 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:adminI have added
npm Bearer Token Realmin Nexus as I saw in many discussions and it didn't make a difference as well.I have tried to use another repo
verdaccioand 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
npmversion6.10What could be a solution here for nexus to work?