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