如何完全删除/禁用"包管理"从VSTS扩展?

时间:2017-03-22 11:00:29

标签: npm azure-devops azure-artifacts

我有一个Visual Studio Team Services帐户,我之前添加了Package Management extension以便拥有私有NPM包。虽然此扩展程序运行良好,但我不再需要它,并已从我的VSTS帐户/团队中删除了所有私人订阅源并禁用了扩展程序。问题是托管构建代理仍尝试从私有NPM注册表获取NPM包。显然这会失败,因为注册表/提要不再存在,导致整个构建失败。我不明白NPM任务从哪里获取此注册表URL以及如何强制使用官方NPM注册表。

我目前正在处理并尝试使用VSTS构建的ASP.NET Core项目没有.npmrc文件。但是,我试图添加一个明确指向官方NPM注册表的.npmrc文件无济于事。

失败的构建步骤是一个简单的NPM任务,NPM命令设置为install。任务的相关部分记录:

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

为什么托管代理仍在尝试使用我的私有NPM包Feed?

1 个答案:

答案 0 :(得分:1)

原来我在我的用户npm shrinkwrap文件中配置了私有NPM注册表的同时运行了.npmrc。即我的shrinkwrap文件包含对VSTS私有NPM提要的引用。傻......; - )