0

I have a Visual Studio Team Services account to which I have previously added the Package Management extension in order to have private NPM packages. While this extension worked very well I do not need it any longer and have removed all private feeds from my VSTS account/team and disabled the extension. The problem is the hosted build agent still tries to get NPM packages from the private NPM registry. Obviously this fails since the registry/feed doesn't exist any longer, causing the entire build to fail. I do not understand where the NPM task gets this registry URL from and how I can force ut to used the official NPM registry instead.

The ASP.NET Core project I am currently working on and trying to build using VSTS has no .npmrc file. I have however tried to add an .npmrc file explicitly pointing to the official NPM registry to no avail.

The failing build step is a simple NPM task with the NPM command set to install. The relevant parts of the task's log:

2017-03-22T10:29:27.4223989Z ##[section]Starting: npm install
2017-03-22T10:29:27.4223989Z ==============================================================================
2017-03-22T10:29:27.4223989Z Task         : npm
2017-03-22T10:29:27.4223989Z Description  : Run an npm command
2017-03-22T10:29:27.4223989Z Version      : 0.2.21
2017-03-22T10:29:27.4223989Z Author       : Microsoft Corporation
2017-03-22T10:29:27.4223989Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613746)
2017-03-22T10:29:27.4223989Z ==============================================================================
2017-03-22T10:29:28.6396903Z SYSTEMVSSCONNECTION exists true
2017-03-22T10:29:28.6426899Z [command]C:\a\_tasks\Npm_fe47e961-9fa8-4106-8639-368c022d43ad\0.2.21\Npm\vsts-npm-auth\bin\vsts-npm-auth.exe -NonInteractive -Verbosity Normal -Config C:\a\1\s\My.Test.Project\.npmrc -TargetConfig C:\a\1\npm\auth.17.npmrc
2017-03-22T10:29:29.5739767Z 
2017-03-22T10:29:29.5739767Z vsts-npm-auth v0.23.0.0 
2017-03-22T10:29:29.5749761Z -----------------------
2017-03-22T10:29:29.6609785Z Creating npmrcFile. Path: C:\a\1\npm\auth.17.npmrc
2017-03-22T10:29:29.9982389Z ##[warning]Failed to get the required authentication tokens for npm. Error: C:\a\_tasks\Npm_fe47e961-9fa8-4106-8639-368c022d43ad\0.2.21\Npm\vsts-npm-auth\bin\vsts-npm-auth.exe failed with return code: 1
2017-03-22T10:29:29.9992390Z [command]C:\Program Files\nodejs\npm.cmd config list
2017-03-22T10:29:35.3801807Z ; cli configs
2017-03-22T10:29:35.3801807Z user-agent = "npm/3.10.10 node/v6.10.0 win32 x64"
2017-03-22T10:29:35.3801807Z 
2017-03-22T10:29:35.3801807Z ; environment configs
2017-03-22T10:29:35.3801807Z userconfig = "C:\\a\\1\\npm\\auth.17.npmrc"
2017-03-22T10:29:35.3801807Z 
2017-03-22T10:29:35.3801807Z ; project config C:\a\1\s\My.Test.Project\.npmrc
2017-03-22T10:29:35.3801807Z always-auth = false
2017-03-22T10:29:35.3801807Z registry = "https://registry.npmjs.org/"
2017-03-22T10:29:35.3801807Z 
2017-03-22T10:29:35.3801807Z ; builtin config undefined
2017-03-22T10:29:35.3801807Z prefix = "C:\\Users\\buildguest\\AppData\\Roaming\\npm"
2017-03-22T10:29:35.3801807Z 
2017-03-22T10:29:35.3801807Z ; node bin location = C:\Program Files\nodejs\node.exe
2017-03-22T10:29:35.3801807Z ; cwd = C:\a\1\s\My.Test.Project
2017-03-22T10:29:35.3801807Z ; HOME = C:\Users\buildguest
2017-03-22T10:29:35.3801807Z ; "npm config ls -l" to show all defaults.
2017-03-22## Heading ##T10:29:35.3801807Z 
2017-03-22T10:29:35.3951806Z [command]C:\Program Files\nodejs\npm.cmd install
2017-03-22T10:29:40.3430346Z npm ERR! fetch failed https://<url.to.deleted.registry>/_packaging/56e9e533-6bd0-4be2-ab7b-dbb28cdb93f6/npm/registry/postcss-selector-parser/upstream/postcss-selector-parser-2.2.3.tgz
2017-03-22T10:29:40.3430346Z npm WARN retry will retry, error on last attempt: Error: fetch failed with status code 401

Why is the hosted agent still trying to use my private NPM package feed?

Community
  • 1
  • 1
David Nordvall
  • 12,404
  • 6
  • 32
  • 52

1 Answers1

1

Turns out I had ran npm shrinkwrap while still having my private NPM registry configured in my user .npmrc file. I.e. my shrinkwrap file contained references to the VSTS private NPM feed. Silly... ;-)

David Nordvall
  • 12,404
  • 6
  • 32
  • 52