NPM Publish: Authentication Fails for VSTS NPM Package Feed
See original GitHub issueI have added an NPM Publish task to my CI Build and I have selected the proper Target Registry for which the package should publish (Using the “Registry I select here” dropdown).
I have the working folder pointed to my package.json which specifies this registry in it’s “publishConfig”:
"publishConfig": { "registry": "https://intellitraks.pkgs.visualstudio.com/_packaging/IntelliTraks/npm/registry/" }
Also, in the same directory as this package.json, I have an .npmrc file like so:
@intellitraks:registry=https://intellitraks.pkgs.visualstudio.com/_packaging/IntelliTraks/npm/registry/ always-auth=true
The build task always fails, mentioning that the machine is not authorized to publish to the registry.
error need auth auth required for publishing
Below is the output of the NPM Publish task:
2017-08-31T18:18:58.2222745Z ##[section]Starting: NPM Publish: Charts 2017-08-31T18:18:58.2222745Z ============================================================================== 2017-08-31T18:18:58.2222745Z Task : npm 2017-08-31T18:18:58.2222745Z Description : Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Package Management. 2017-08-31T18:18:58.2222745Z Version : 1.0.4 2017-08-31T18:18:58.2222745Z Author : Microsoft Corporation 2017-08-31T18:18:58.2222745Z Help : More Information 2017-08-31T18:18:58.2222745Z ============================================================================== 2017-08-31T18:18:58.8822774Z SYSTEMVSSCONNECTION exists true 2017-08-31T18:18:58.9592738Z SYSTEMVSSCONNECTION exists true 2017-08-31T18:19:01.6332731Z [command]C:\Windows\system32\cmd.exe /D /S /C ““C:\Program Files\nodejs\npm.cmd” config list” 2017-08-31T18:19:02.9252744Z npm info it worked if it ends with ok 2017-08-31T18:19:02.9252744Z npm verb cli [ ‘C:\Program Files\nodejs\node.exe’, 2017-08-31T18:19:02.9252744Z npm verb cli ‘C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js’, 2017-08-31T18:19:02.9252744Z npm verb cli ‘prefix’, 2017-08-31T18:19:02.9252744Z npm verb cli ‘-g’ ] 2017-08-31T18:19:02.9252744Z npm info using npm@3.10.8 2017-08-31T18:19:02.9252744Z npm info using node@v6.9.1 2017-08-31T18:19:02.9252744Z npm verb exit [ 0, true ] 2017-08-31T18:19:02.9252744Z npm info ok 2017-08-31T18:19:02.9252744Z npm info it worked if it ends with ok 2017-08-31T18:19:02.9252744Z npm verb cli [ ‘C:\Program Files\nodejs\node.exe’, 2017-08-31T18:19:02.9252744Z npm verb cli ‘C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js’, 2017-08-31T18:19:02.9252744Z npm verb cli ‘config’, 2017-08-31T18:19:02.9252744Z npm verb cli ‘list’ ] 2017-08-31T18:19:02.9252744Z npm info using npm@3.10.8 2017-08-31T18:19:02.9252744Z npm info using node@v6.9.1 2017-08-31T18:19:02.9252744Z npm verb exit [ 0, true ] 2017-08-31T18:19:02.9252744Z npm info ok 2017-08-31T18:19:02.9252744Z ; cli configs 2017-08-31T18:19:02.9252744Z user-agent = “npm/3.10.8 node/v6.9.1 win32 x64” 2017-08-31T18:19:02.9252744Z 2017-08-31T18:19:02.9252744Z ; environment configs 2017-08-31T18:19:02.9252744Z cache = “C:\NPM\Cache” 2017-08-31T18:19:02.9252744Z loglevel = “verbose” 2017-08-31T18:19:02.9252744Z prefix = “C:\NPM\Modules” 2017-08-31T18:19:02.9252744Z userconfig = “d:\a\1\npm\84.npmrc” 2017-08-31T18:19:02.9252744Z 2017-08-31T18:19:02.9252744Z ; project config d:\a\1\s\src\app.npmrc 2017-08-31T18:19:02.9252744Z @intellitraks:registry = “https://intellitraks.pkgs.visualstudio.com/_packaging/IntelliTraks/npm/registry/” 2017-08-31T18:19:02.9252744Z always-auth = true 2017-08-31T18:19:02.9252744Z 2017-08-31T18:19:02.9252744Z ; userconfig d:\a\1\npm\84.npmrc 2017-08-31T18:19:02.9252744Z registry = “https://intellitraks.pkgs.visualstudio.com/_packaging/490cdf13-5f49-49f2-99c8-d9223e57a792/npm/registry/” 2017-08-31T18:19:02.9252744Z 2017-08-31T18:19:02.9252744Z ; globalconfig C:\NPM\Modules\etc\npmrc 2017-08-31T18:19:02.9252744Z 2017-08-31T18:19:02.9252744Z ; builtin config undefined 2017-08-31T18:19:02.9252744Z 2017-08-31T18:19:02.9252744Z ; node bin location = C:\Program Files\nodejs\node.exe 2017-08-31T18:19:02.9252744Z ; cwd = d:\a\1\s\src\app 2017-08-31T18:19:02.9252744Z ; HOME = C:\Users\buildguest 2017-08-31T18:19:02.9252744Z ; “npm config ls -l” to show all defaults. 2017-08-31T18:19:02.9252744Z 2017-08-31T18:19:02.9282745Z [command]C:\Windows\system32\cmd.exe /D /S /C ““C:\Program Files\nodejs\npm.cmd” publish” 2017-08-31T18:19:03.2812752Z npm info it worked if it ends with ok 2017-08-31T18:19:03.2812752Z npm verb cli [ ‘C:\Program Files\nodejs\node.exe’, 2017-08-31T18:19:03.2812752Z npm verb cli ‘C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js’, 2017-08-31T18:19:03.2812752Z npm verb cli ‘prefix’, 2017-08-31T18:19:03.2812752Z npm verb cli ‘-g’ ] 2017-08-31T18:19:03.2812752Z npm info using npm@3.10.8 2017-08-31T18:19:03.2812752Z npm info using node@v6.9.1 2017-08-31T18:19:03.5552748Z npm verb exit [ 0, true ] 2017-08-31T18:19:03.5592745Z npm info ok 2017-08-31T18:19:03.9282753Z npm info it worked if it ends with ok 2017-08-31T18:19:03.9282753Z npm verb cli [ ‘C:\Program Files\nodejs\node.exe’, 2017-08-31T18:19:03.9282753Z npm verb cli ‘C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js’, 2017-08-31T18:19:03.9282753Z npm verb cli ‘publish’ ] 2017-08-31T18:19:03.9282753Z npm info using npm@3.10.8 2017-08-31T18:19:03.9282753Z npm info using node@v6.9.1 2017-08-31T18:19:04.2302743Z npm verb publish [ ‘.’ ] 2017-08-31T18:19:04.3252745Z npm verb cache add spec . 2017-08-31T18:19:04.3302744Z npm verb addLocalDirectory C:\NPM\Cache@intellitraks\charts\1.1.9\package.tgz not in flight; packing 2017-08-31T18:19:04.3302744Z npm verb correctMkdir C:\NPM\Cache correctMkdir not in flight; initializing 2017-08-31T18:19:04.3322754Z npm info lifecycle @intellitraks/charts@1.1.9~prepublish: @intellitraks/charts@1.1.9 2017-08-31T18:19:04.3442753Z npm verb tar pack [ ‘C:\NPM\Cache\@intellitraks\charts\1.1.9\package.tgz’, 2017-08-31T18:19:04.3442753Z npm verb tar pack ‘d:\a\1\s\src\app’ ] 2017-08-31T18:19:04.3442753Z npm verb tarball C:\NPM\Cache@intellitraks\charts\1.1.9\package.tgz 2017-08-31T18:19:04.3442753Z npm verb folder d:\a\1\s\src\app 2017-08-31T18:19:04.4199705Z npm verb addLocalTarball adding from inside cache C:\NPM\Cache@intellitraks\charts\1.1.9\package.tgz 2017-08-31T18:19:04.4199705Z npm verb correctMkdir C:\NPM\Cache correctMkdir not in flight; initializing 2017-08-31T18:19:04.4239702Z npm verb afterAdd C:\NPM\Cache@intellitraks\charts\1.1.9\package\package.json not in flight; writing 2017-08-31T18:19:04.4239702Z npm verb correctMkdir C:\NPM\Cache correctMkdir not in flight; initializing 2017-08-31T18:19:04.4279699Z npm verb afterAdd C:\NPM\Cache@intellitraks\charts\1.1.9\package\package.json written 2017-08-31T18:19:04.4289701Z npm verb getPublishConfig { registry: ‘https://intellitraks.pkgs.visualstudio.com/_packaging/IntelliTraks/npm/registry/’ } 2017-08-31T18:19:04.4329711Z npm verb mapToRegistry no registry URL found in name for scope @intellitraks 2017-08-31T18:19:04.4349698Z npm verb publish registryBase https://intellitraks.pkgs.visualstudio.com/_packaging/IntelliTraks/npm/registry/ 2017-08-31T18:19:04.4379703Z npm verb stack Error: auth required for publishing 2017-08-31T18:19:04.4379703Z npm verb stack at CachingRegistryClient.publish (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-registry-client\lib\publish.js:30:14) 2017-08-31T18:19:04.4389705Z npm verb stack at C:\Program Files\nodejs\node_modules\npm\lib\publish.js:138:14 2017-08-31T18:19:04.4389705Z npm verb stack at mapToRegistry (C:\Program Files\nodejs\node_modules\npm\lib\utils\map-to-registry.js:62:3) 2017-08-31T18:19:04.4389705Z npm verb stack at publish_ (C:\Program Files\nodejs\node_modules\npm\lib\publish.js:107:3) 2017-08-31T18:19:04.4389705Z npm verb stack at Array.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\slide\lib\bind-actor.js:15:8) 2017-08-31T18:19:04.4389705Z npm verb stack at LOOP (C:\Program Files\nodejs\node_modules\npm\node_modules\slide\lib\chain.js:15:14) 2017-08-31T18:19:04.4389705Z npm verb stack at LOOP (C:\Program Files\nodejs\node_modules\npm\node_modules\slide\lib\chain.js:14:28) 2017-08-31T18:19:04.4389705Z npm verb stack at chain (C:\Program Files\nodejs\node_modules\npm\node_modules\slide\lib\chain.js:20:5) 2017-08-31T18:19:04.4389705Z npm verb stack at C:\Program Files\nodejs\node_modules\npm\lib\publish.js:73:5 2017-08-31T18:19:04.4389705Z npm verb stack at RES (C:\Program Files\nodejs\node_modules\npm\node_modules\inflight\inflight.js:23:14) 2017-08-31T18:19:04.4389705Z npm verb cwd d:\a\1\s\src\app 2017-08-31T18:19:04.4389705Z npm ERR! Windows_NT 6.3.9600 2017-08-31T18:19:04.4389705Z npm ERR! argv “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js” “publish” 2017-08-31T18:19:04.4389705Z npm ERR! node v6.9.1 2017-08-31T18:19:04.4389705Z npm ERR! npm v3.10.8 2017-08-31T18:19:04.4389705Z npm ERR! code ENEEDAUTH 2017-08-31T18:19:04.4409703Z 2017-08-31T18:19:04.4419712Z npm ERR! need auth auth required for publishing 2017-08-31T18:19:04.4419712Z npm ERR! need auth You need to authorize this machine using
npm adduser
2017-08-31T18:19:04.4419712Z npm verb exit [ 1, true ] 2017-08-31T18:19:04.4459710Z 2017-08-31T18:19:04.4469706Z npm ERR! Please include the following file with any support request: 2017-08-31T18:19:04.4469706Z npm ERR! d:\a\1\s\src\app\npm-debug.log 2017-08-31T18:19:04.4639706Z Found npm debug log, make sure the path matches with the one in npm’s output: d:\a\1\s\src\app\npm-debug.log 2017-08-31T18:19:04.4659705Z 0 info it worked if it ends with ok 2017-08-31T18:19:04.4659705Z 1 verbose cli [ ‘C:\Program Files\nodejs\node.exe’, 2017-08-31T18:19:04.4659705Z 1 verbose cli ‘C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js’, 2017-08-31T18:19:04.4659705Z 1 verbose cli ‘publish’ ] 2017-08-31T18:19:04.4659705Z 2 info using npm@3.10.8 2017-08-31T18:19:04.4659705Z 3 info using node@v6.9.1 2017-08-31T18:19:04.4659705Z 4 verbose publish [ ‘.’ ] 2017-08-31T18:19:04.4659705Z 5 silly cache add args [ ‘.’, null ] 2017-08-31T18:19:04.4659705Z 6 verbose cache add spec . 2017-08-31T18:19:04.4659705Z 7 silly cache add parsed spec Result { 2017-08-31T18:19:04.4659705Z 7 silly cache add raw: ‘.’, 2017-08-31T18:19:04.4659705Z 7 silly cache add scope: null, 2017-08-31T18:19:04.4659705Z 7 silly cache add escapedName: null, 2017-08-31T18:19:04.4659705Z 7 silly cache add name: null, 2017-08-31T18:19:04.4659705Z 7 silly cache add rawSpec: ‘.’, 2017-08-31T18:19:04.4659705Z 7 silly cache add spec: ‘d:\a\1\s\src\app’, 2017-08-31T18:19:04.4659705Z 7 silly cache add type: ‘directory’ } 2017-08-31T18:19:04.4659705Z 8 verbose addLocalDirectory C:\NPM\Cache@intellitraks\charts\1.1.9\package.tgz not in flight; packing 2017-08-31T18:19:04.4659705Z 9 verbose correctMkdir C:\NPM\Cache correctMkdir not in flight; initializing 2017-08-31T18:19:04.4659705Z 10 info lifecycle @intellitraks/charts@1.1.9~prepublish: @intellitraks/charts@1.1.9 2017-08-31T18:19:04.4659705Z 11 silly lifecycle @intellitraks/charts@1.1.9~prepublish: no script for prepublish, continuing 2017-08-31T18:19:04.4659705Z 12 verbose tar pack [ ‘C:\NPM\Cache\@intellitraks\charts\1.1.9\package.tgz’, 2017-08-31T18:19:04.4659705Z 12 verbose tar pack ‘d:\a\1\s\src\app’ ] 2017-08-31T18:19:04.4659705Z 13 verbose tarball C:\NPM\Cache@intellitraks\charts\1.1.9\package.tgz 2017-08-31T18:19:04.4659705Z 14 verbose folder d:\a\1\s\src\app 2017-08-31T18:19:04.4659705Z 15 verbose addLocalTarball adding from inside cache C:\NPM\Cache@intellitraks\charts\1.1.9\package.tgz 2017-08-31T18:19:04.4659705Z 16 verbose correctMkdir C:\NPM\Cache correctMkdir not in flight; initializing 2017-08-31T18:19:04.4659705Z 17 silly cache afterAdd @intellitraks/charts@1.1.9 2017-08-31T18:19:04.4659705Z 18 verbose afterAdd C:\NPM\Cache@intellitraks\charts\1.1.9\package\package.json not in flight; writing 2017-08-31T18:19:04.4659705Z 19 verbose correctMkdir C:\NPM\Cache correctMkdir not in flight; initializing 2017-08-31T18:19:04.4659705Z 20 verbose afterAdd C:\NPM\Cache@intellitraks\charts\1.1.9\package\package.json written 2017-08-31T18:19:04.4659705Z 21 silly publish { name: ‘@intellitraks/charts’, 2017-08-31T18:19:04.4659705Z 21 silly publish version: ‘1.1.9’, 2017-08-31T18:19:04.4659705Z 21 silly publish description: ‘Intellitraks Chart Library for Angular 4+ Apps’, 2017-08-31T18:19:04.4659705Z 21 silly publish typings: ‘index.ts’, 2017-08-31T18:19:04.4659705Z 21 silly publish scripts: { test: ‘echo “Error: no test specified” && exit 1’ }, 2017-08-31T18:19:04.4659705Z 21 silly publish author: { name: ‘Pat Goins, Tyler Landis’ }, 2017-08-31T18:19:04.4659705Z 21 silly publish license: ‘ISC’, 2017-08-31T18:19:04.4669707Z 21 silly publish devDependencies: {}, 2017-08-31T18:19:04.4669707Z 21 silly publish publishConfig: { registry: ‘https://intellitraks.pkgs.visualstudio.com/_packaging/IntelliTraks/npm/registry/’ }, 2017-08-31T18:19:04.4669707Z 21 silly publish dependencies: { c3: ‘0.4.17’, d3: ‘3.5.0’ }, 2017-08-31T18:19:04.4669707Z 21 silly publish readme: ‘ERROR: No README data found!’, 2017-08-31T18:19:04.4669707Z 21 silly publish _id: ‘@intellitraks/charts@1.1.9’, 2017-08-31T18:19:04.4669707Z 21 silly publish _shasum: ‘1bd4de83d764b49320ad55b65f594c583b708d08’, 2017-08-31T18:19:04.4669707Z 21 silly publish from: ‘.’ } 2017-08-31T18:19:04.4669707Z 22 verbose getPublishConfig { registry: ‘https://intellitraks.pkgs.visualstudio.com/_packaging/IntelliTraks/npm/registry/’ } 2017-08-31T18:19:04.4669707Z 23 silly mapToRegistry name @intellitraks/charts 2017-08-31T18:19:04.4669707Z 24 silly mapToRegistry scope (from package name) @intellitraks 2017-08-31T18:19:04.4669707Z 25 verbose mapToRegistry no registry URL found in name for scope @intellitraks 2017-08-31T18:19:04.4669707Z 26 silly mapToRegistry using default registry 2017-08-31T18:19:04.4669707Z 27 silly mapToRegistry registry https://intellitraks.pkgs.visualstudio.com/_packaging/IntelliTraks/npm/registry/ 2017-08-31T18:19:04.4669707Z 28 silly mapToRegistry data Result { 2017-08-31T18:19:04.4669707Z 28 silly mapToRegistry raw: ‘@intellitraks/charts’, 2017-08-31T18:19:04.4669707Z 28 silly mapToRegistry scope: ‘@intellitraks’, 2017-08-31T18:19:04.4669707Z 28 silly mapToRegistry escapedName: ‘@intellitraks%2fcharts’, 2017-08-31T18:19:04.4669707Z 28 silly mapToRegistry name: ‘@intellitraks/charts’, 2017-08-31T18:19:04.4669707Z 28 silly mapToRegistry rawSpec: ‘’, 2017-08-31T18:19:04.4669707Z 28 silly mapToRegistry spec: ‘latest’, 2017-08-31T18:19:04.4669707Z 28 silly mapToRegistry type: ‘tag’ } 2017-08-31T18:19:04.4669707Z 29 silly mapToRegistry uri https://intellitraks.pkgs.visualstudio.com/_packaging/IntelliTraks/npm/registry/@intellitraks%2Fcharts 2017-08-31T18:19:04.4669707Z 30 verbose publish registryBase https://intellitraks.pkgs.visualstudio.com/_packaging/IntelliTraks/npm/registry/ 2017-08-31T18:19:04.4669707Z 31 silly publish uploading C:\NPM\Cache@intellitraks\charts\1.1.9\package.tgz 2017-08-31T18:19:04.4669707Z 32 verbose stack Error: auth required for publishing 2017-08-31T18:19:04.4669707Z 32 verbose stack at CachingRegistryClient.publish (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-registry-client\lib\publish.js:30:14) 2017-08-31T18:19:04.4669707Z 32 verbose stack at C:\Program Files\nodejs\node_modules\npm\lib\publish.js:138:14 2017-08-31T18:19:04.4669707Z 32 verbose stack at mapToRegistry (C:\Program Files\nodejs\node_modules\npm\lib\utils\map-to-registry.js:62:3) 2017-08-31T18:19:04.4669707Z 32 verbose stack at publish (C:\Program Files\nodejs\node_modules\npm\lib\publish.js:107:3) 2017-08-31T18:19:04.4669707Z 32 verbose stack at Array.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\slide\lib\bind-actor.js:15:8) 2017-08-31T18:19:04.4669707Z 32 verbose stack at LOOP (C:\Program Files\nodejs\node_modules\npm\node_modules\slide\lib\chain.js:15:14) 2017-08-31T18:19:04.4669707Z 32 verbose stack at LOOP (C:\Program Files\nodejs\node_modules\npm\node_modules\slide\lib\chain.js:14:28) 2017-08-31T18:19:04.4669707Z 32 verbose stack at chain (C:\Program Files\nodejs\node_modules\npm\node_modules\slide\lib\chain.js:20:5) 2017-08-31T18:19:04.4669707Z 32 verbose stack at C:\Program Files\nodejs\node_modules\npm\lib\publish.js:73:5 2017-08-31T18:19:04.4669707Z 32 verbose stack at RES (C:\Program Files\nodejs\node_modules\npm\node_modules\inflight\inflight.js:23:14) 2017-08-31T18:19:04.4669707Z 33 verbose cwd d:\a\1\s\src\app 2017-08-31T18:19:04.4669707Z 34 error Windows_NT 6.3.9600 2017-08-31T18:19:04.4669707Z 35 error argv “C:\Program Files\nodejs\node.exe” “C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js” “publish” 2017-08-31T18:19:04.4679704Z 36 error node v6.9.1 2017-08-31T18:19:04.4679704Z 37 error npm v3.10.8 2017-08-31T18:19:04.4679704Z 38 error code ENEEDAUTH 2017-08-31T18:19:04.4679704Z 39 error need auth auth required for publishing 2017-08-31T18:19:04.4679704Z 40 error need auth You need to authorize this machine usingnpm adduser
2017-08-31T18:19:04.4679704Z 41 verbose exit [ 1, true ] 2017-08-31T18:19:04.4679704Z 2017-08-31T18:19:04.4759706Z ##[error]Error: C:\Program Files\nodejs\npm.cmd failed with return code: 1
Issue Analytics
- State:
- Created 6 years ago
- Comments:10 (2 by maintainers)
It looks like your package.json has the “publishConfig” property set with the registry set to your feed, we use a different format when injecting credentials so this property may be overriding our auth. Can you try removing the registry from “publishConfig” and trying again?
I’m pushing a fix now to the docs (which have moved here) - it should be live in 10-20 minutes. I’ll also add an item to our backlog to see if we can support the
publishConfig
flow in a future version of the npm task.