On Premise Agent不下载所有NPM包

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了On Premise Agent不下载所有NPM包相关的知识,希望对你有一定的参考价值。

编辑:2018-02-28 - 添加构建定义的屏幕截图

我在内部部署VSTS代理时遇到问题。当'npm install'运行时,它只安装大约20%的软件包。该命令没有错误输出。如果我在远程进入机器时运行相同的NPM安装命令,则会安装所有软件包。我在Visual Studio Team Services Hosted Images脚本中手动使用了相同的步骤。特别是Install-NodeLts.ps1

我需要运行本地代理,以便我们的构建完成。

npm / 5.6.0 node / v8.9.4 win32 x64

您可以在下面看到它说:'在37.875s中添加了559个包',但是当从命令行通过RDP运行npm install时,它会安装2419个包。

我试过了:

  • 将NPM重新安装为任务
  • 运行npm install两次作为两个不同的任务
  • 从命令任务运行npm install
  • 运行代理作为我的同一用户帐户

enter image description here

部分输出日志:

2018-02-27T21:30:59.6386335Z ##[section]Starting: npm install 2018-02-27T21:30:59.6396849Z ============================================================================== 2018-02-27T21:30:59.6397102Z Task : npm 2018-02-27T21:30:59.6397398Z Description : Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Package Management. 2018-02-27T21:30:59.6397690Z Version : 1.0.10 2018-02-27T21:30:59.6397884Z Author : Microsoft Corporation 2018-02-27T21:30:59.6398144Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613746) 2018-02-27T21:30:59.6398400Z ============================================================================== 2018-02-27T21:31:00.7066189Z [command]C:WINDOWSsystem32cmd.exe /D /S /C ""C:Program Files odejs pm.cmd" --version" 2018-02-27T21:31:02.6879301Z 5.6.0 2018-02-27T21:31:07.0100259Z [command]C:WINDOWSsystem32cmd.exe /D /S /C ""C:Program Files odejs pm.cmd" config list" 2018-02-27T21:31:09.1937476Z npm info it worked if it ends with ok 2018-02-27T21:31:09.1938350Z npm verb cli [ 'C:Program Files odejs ode.exe', 2018-02-27T21:31:09.1938614Z npm verb cli 'C:Program Files odejs ode_modules pmin pm-cli.js', 2018-02-27T21:31:09.1938859Z npm verb cli 'prefix', 2018-02-27T21:31:09.1939038Z npm verb cli '-g' ] 2018-02-27T21:31:09.1939210Z npm info using npm@5.6.0 2018-02-27T21:31:09.1939414Z npm info using node@v8.9.4 2018-02-27T21:31:09.1939594Z npm verb exit [ 0, true ] 2018-02-27T21:31:09.1939806Z npm info ok 2018-02-27T21:31:09.1940065Z npm info it worked if it ends with ok 2018-02-27T21:31:09.1940314Z npm verb cli [ 'C:Program Files odejs ode.exe', 2018-02-27T21:31:09.1940577Z npm verb cli 'C: pmprefix ode_modules pmin pm-cli.js', 2018-02-27T21:31:09.1940790Z npm verb cli 'config', 2018-02-27T21:31:09.1941046Z npm verb cli 'list' ] 2018-02-27T21:31:09.1941258Z npm info using npm@5.6.0 2018-02-27T21:31:09.1941470Z npm info using node@v8.9.4 2018-02-27T21:31:09.1941711Z npm verb exit [ 0, true ] 2018-02-27T21:31:09.1941956Z npm info ok 2018-02-27T21:31:09.1942165Z ; cli configs 2018-02-27T21:31:09.1942384Z metrics-registry = "https://registry.npmjs.org/" 2018-02-27T21:31:09.1942647Z scope = "" 2018-02-27T21:31:09.1942849Z user-agent = "npm/5.6.0 node/v8.9.4 win32 x64" 2018-02-27T21:31:09.1942977Z 2018-02-27T21:31:09.1943141Z ; environment configs 2018-02-27T21:31:09.1943350Z cache = "C: pmcache" 2018-02-27T21:31:09.1943529Z loglevel = "verbose" 2018-02-27T21:31:09.1943712Z prefix = "C: pmprefix" 2018-02-27T21:31:09.1943927Z userconfig = "D:VSTSAgentvsts-agent-win-x64-2.129.1\_work2 pm187.npmrc" 2018-02-27T21:31:09.1944096Z 2018-02-27T21:31:09.1944268Z ; builtin config undefined 2018-02-27T21:31:09.1944399Z 2018-02-27T21:31:09.1944626Z ; node bin location = C:Program Files odejs ode.exe 2018-02-27T21:31:09.1944941Z ; cwd = D:VSTSAgentvsts-agent-win-x64-2.129.1\_work2sWeb 2018-02-27T21:31:09.1945215Z ; HOME = C:Usersolducp 2018-02-27T21:31:09.1945445Z ; "npm config ls -l" to show all defaults. 2018-02-27T21:31:09.1945592Z 2018-02-27T21:31:09.1947815Z [command]C:WINDOWSsystem32cmd.exe /D /S /C ""C:Program Files odejs pm.cmd" install" 2018-02-27T21:31:50.2618021Z npm info it worked if it ends with ok 2018-02-27T21:31:50.2618358Z 2018-02-27T21:31:50.2623471Z > react-bootstrap-select@0.14.0 postinstall D:VSTSAgentvsts-agent-win-x64-2.129.1\_work2sWeb ode_modules eact-bootstrap-select 2018-02-27T21:31:50.2624421Z npm verb cli [ 'C:Program Files odejs ode.exe', 2018-02-27T21:31:50.2624674Z > jsx jsx/ dist/ 2018-02-27T21:31:50.2624944Z npm verb cli 'C:Program Files odejs ode_modules pmin pm-cli.js', 2018-02-27T21:31:50.2625391Z 2018-02-27T21:31:50.2625873Z ["Select"] 2018-02-27T21:31:50.2627029Z added 559 packages in 37.875s 2018-02-27T21:31:50.2636988Z npm verb cli 'prefix', 2018-02-27T21:31:50.2637434Z npm verb cli '-g' ] 2018-02-27T21:31:50.2639621Z npm info using npm@5.6.0 2018-02-27T21:31:50.2639731Z npm info using node@v8.9.4 2018-02-27T21:31:50.2639837Z npm verb exit [ 0, true ] 2018-02-27T21:31:50.2640063Z npm info ok 2018-02-27T21:31:50.2640199Z npm info it worked if it ends with ok 2018-02-27T21:31:50.2640352Z npm verb cli [ 'C:Program Files odejs ode.exe', 2018-02-27T21:31:50.2640480Z npm verb cli 'C: pmprefix ode_modules pmin pm-cli.js', 2018-02-27T21:31:50.2640597Z npm verb cli 'install' ] 2018-02-27T21:31:50.2640700Z npm info using npm@5.6.0 2018-02-27T21:31:50.2640835Z npm info using node@v8.9.4 2018-02-27T21:31:50.2640945Z npm verb npm-session 7bedb538a9b4e7b7 2018-02-27T21:31:50.2641065Z npm info lifecycle company-project@1.0.0~preinstall: company-project@1.0.0 2018-02-27T21:31:50.2641230Z npm http fetch GET 304 https://registry.npmjs.org/moment 375ms (from cache) ... 2018-02-27T21:31:50.3412460Z npm verb exit [ 0, true ] 2018-02-27T21:31:50.3412559Z npm info ok 2018-02-27T21:31:50.3416231Z ##[section]Finishing: npm install

答案

在设置托管代理时,我修改了构建定义以包含环境变量NODE_ENV = production。当NODE_ENV环境变量设置为production时,npm将不会安装devDependencies中列出的模块。

以上是关于On Premise Agent不下载所有NPM包的主要内容,如果未能解决你的问题,请参考以下文章

如何使用 Google Vision OCR On-Premise? [关闭]

TFS 2015 On Premise - 更改浏览器中新文件的默认编码

Private Cloud和On-Premise区别

Agora On-premise 录制 SDK 录制的影片的顶端和底端被截断

Zabbix agent on Microsoft Windows

SharePoint On Premise/ SharePoint Online增强格式的文本栏