Getting ENEEDAUTH after adjusting .npmrc _auth setting as scoped

As part of my CI/CD system, I use a private NPM registry with .npmrc and _auth as described in [1] to connect and it has worked just fine when using NPM 7 and 8, however, when execute pipelines to build NodeJS apps using NPM 9, I’ve got the following error that _auth setting must be scoped

npm ERR! Invalid auth configuration found: _auth must be renamed to // in project config
npm ERR! Please run npm config fix to repair your configuration.`

After implementing the .npmrc changes suggested for the _auth setting, builds are working fine for Node apps using NPM 9, however, we are getting the following error when use the same .npmrc settings (updated for NPM 9) in NPM 8 apps when trying to run npm publish command:

npm notice
npm ERR! need auth This command requires you to be logged in to
npm ERR! need auth You need to authorize this machine using npm adduser

Is this a use case supported by Sonatype Nexus ? Any thoughts ?


I think this is really a question for the npm team about how to configure the .npmrc for different versions of the npm cli