Reputation: 1005
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.
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"
}
}
Upvotes: 1
Views: 1503
Reputation: 330
Unfortunately, NPM Connection build feature only works with nodejs runner. You should replace Command Line runner with NodeJS one. For more information see https://youtrack.jetbrains.com/issue/TW-73072/Npm-connection-not-working-without-Nodejs-step
Upvotes: 1