1

I want to write a pipeline to publish an Angular library however, I'm getting an error

npm ERR! code ENEEDAUTH
npm ERR! need auth This command requires you to be logged in to https://registry.npmjs.org/
npm ERR! need auth You need to authorize this machine using `npm adduser`

In my pipeline I have the following steps:

- task: npmAuthenticate@0
  displayName: Authenticate via NPM
  inputs:
    workingFile: $(WorkDirectory)/middleware-angular/.npmrc

 // install and build steps...

- script: |
    cd $(WorkDirectory)/middleware-angular
    npm publish dist
  displayName: 'Publish package'

The .npmrc file is located in the middleware-angular folder

I don't understand why I need to log in to npm if I have added the npm authenticate task, by the way, it worked with Node version 14 but stopped when I changed it to 16

Roni_Droni
  • 35
  • 2
  • 7
  • it's possible that the version of Node you are using in your pipeline may be causing the issue. Node.js version 16 introduced some breaking changes compared to version 14, which may be causing your NPM authentication to fail. To resolve this issue, you can try upgrading the version of the npmAuthenticate task you are using to a version that is compatible with Node.js version 16. You can check the task documentation or release notes to see if the task version you are using is compatible with Node.js version 16. – Moufeed Juboqji Apr 07 '23 at 09:46

0 Answers0