npm - TFS npm install 构建任务挂起?

标签 npm tfs tfsbuild npm-install

我们正在使用 TFS 构建任务,其中一项任务运行 npm install .这不是通过批处理或 powershell 文件。

它运行成功,但看起来它完成了,然后挂了大约 3 到 4 分钟。我知道这是因为任务摘要说它已成功完成,但它在 3 到 4 分钟内没有开始下一个任务。

本来我加任务的时候,我觉得不会这样挂的。我不确定发生了什么变化。

我尝试使用 npm set progress=false , 推荐自 this forum并在 this article 中解释.我还没有添加 npm-cache因为它似乎不相关;请记住,构建任务成功完成然后挂起。

什么可能导致 npm 任务在完成后挂起?

最佳答案

根据你的描述,是有道理的。 NPM 安装只是在浪费时间,因为它需要 3-4 分钟才能到 确定软件包已经安装。

首先尝试从控制台运行您的 npm 以查看 TFS 上的性能是否正常。如果你所有的 NPM 任务都需要很长时间,一种可能与 nodejs 版本有关。

例如,您使用的是最新版本,例如安装在构建代理上的 nodejs (8.2.0)。然后降级到最新的 LTS(长期支持)版本 (6.11.1) 可能会为您解决问题。详情请看这个blog .

另一种方法是使用 npm-cache作为替代方法,因为您使用本地构建代理进行构建。

It is useful for build processes that run [npm|bower|composer|jspm] install every time as part of their build process. Since dependencies don't change often, this often means slower build times. npm-cache helps alleviate this problem by caching previously installed dependencies on the build machine. npm-cache can be a drop-in replacement for any build script that runs [npm|bower|composer|jspm] install.

How it Works

When you run npm-cache install [npm|bower|jspm|composer], it first looks for package.json, bower.json, or composer.json in the current working directory depending on which dependency manager is requested. It then calculates the MD5 hash of the configuration file and looks for a filed named .tar.gz in the cache directory ($HOME/.package_cache by default). If the file does not exist, npm-cache uses the system's installed dependency manager to install the dependencies. Once the dependencies are installed, npm-cache tars the newly downloaded dependencies and stores them in the cache directory. The next time npm-cache runs and sees the same config file, it will find the tarball in the cache directory and untar the dependencies in the current working directory.



样本供您引用:Speed up your npm dependent CI build

关于npm - TFS npm install 构建任务挂起?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46900297/

相关文章:

node.js - Node 类型意外标记 =>

tfs - 哪些构建正在使用特定的构建代理

git - 在 VSTF 构建中查看 git-lfs 文件

build-process - Team Build的版本号和$(Rev :. r)

angular - 对象对象不是 PostCSS 插件 - 构建 nrwl 库项目时出错

node.js - SQLite 在 Windows 10 上无法与 Electron 和 Node 一起使用

testing - 如何判断测试用例(TFS 工作项)已经过测试?

tfs - 无法访问 MSBuild 中的 ArtifactStagingDirectory 变量

powershell - TFS 构建 : `Microsoft.TeamFoundation.PowerShell' is not installed on this computer

google-chrome-extension - 是否可以在 chrome 扩展中需要 npm 模块?