Using NPM Registry Connection build feature in TeamCity to publish a package

Viewed 79

In TeamCity, I have configured an "NPM Registry Connection" build feature following this Jetbrains guide. When testing a connection for my package it gives me the "Success" message.

enter image description here

Then I added this connection as a build feature to my Build Configuration. I do not see any additional steps in any documentation that should be applied so I thought that, now, simply calling npm publish will succeed but instead I'm getting

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

My build configuration:

steps {
    script {
        name = "install"
        scriptContent = "npm ci && npm install jest-teamcity --no-save"
        formatStderrAsError = true
    }
    script {
        name = "eslint"
        scriptContent = "npm run eslint"
        formatStderrAsError = true
    }
    script {
        name = "build"
        scriptContent = "npm run clean && npx tsc"
        formatStderrAsError = true
    }
    script {
        name = "test"
        scriptContent = "npm run test -- --reporters=jest-teamcity"
        formatStderrAsError = true
    }
    script {
        name = "publish"
        scriptContent = "npm publish"
        formatStderrAsError = true
    }
}

triggers {
    vcs {
    }
}

features {
    npmRegistry {
        connectionId = "PROJECT_EXT_2"
    }
}
1 Answers
Related