Interview Prep/CI/CD/Build Tools, Nexus, SonarQube and Test Failures

`npm ERR! code E401` / `Unable to authenticate, need: Basic realm="Sonatype Nexus Repository Manager"`.

IntermediateTroubleshootingBuild Tools, Nexus, SonarQube and Test Failures
Answer

Likely causes → Missing or wrong _auth/_authToken in .npmrc; npm Bearer Token realm not enabled in Nexus.

Diagnose → npm config list, npm whoami --registry <url>.

Fix → Provide credentials in .npmrc from CI secrets and enable the "npm Bearer Token Realm" or use Basic auth correctly.

Prevent → Template .npmrc creation in the pipeline.

All CI/CD questions Roadmap: CI/CD fundamentals

More on Build Tools, Nexus, SonarQube and Test Failures