修改: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个包。
我试过了:
部分输出日志:
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:\WINDOWS\system32\cmd.exe /D /S /C ""C:\Program Files\nodejs\npm.cmd" --version"
2018-02-27T21:31:02.6879301Z 5.6.0
2018-02-27T21:31:07.0100259Z [command]C:\WINDOWS\system32\cmd.exe /D /S /C ""C:\Program Files\nodejs\npm.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\\nodejs\\node.exe',
2018-02-27T21:31:09.1938614Z npm verb cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-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\\nodejs\\node.exe',
2018-02-27T21:31:09.1940577Z npm verb cli 'C:\\npm\\prefix\\node_modules\\npm\\bin\\npm-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:\\npm\\cache"
2018-02-27T21:31:09.1943529Z loglevel = "verbose"
2018-02-27T21:31:09.1943712Z prefix = "C:\\npm\\prefix"
2018-02-27T21:31:09.1943927Z userconfig = "D:\\VSTSAgent\\vsts-agent-win-x64-2.129.1\\_work\\2\\npm\\187.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\nodejs\node.exe
2018-02-27T21:31:09.1944941Z ; cwd = D:\VSTSAgent\vsts-agent-win-x64-2.129.1\_work\2\s\Web
2018-02-27T21:31:09.1945215Z ; HOME = C:\Users\bolducp
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:\WINDOWS\system32\cmd.exe /D /S /C ""C:\Program Files\nodejs\npm.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:\VSTSAgent\vsts-agent-win-x64-2.129.1\_work\2\s\Web\node_modules\react-bootstrap-select
2018-02-27T21:31:50.2624421Z npm verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
2018-02-27T21:31:50.2624674Z > jsx jsx/ dist/
2018-02-27T21:31:50.2624944Z npm verb cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-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\\nodejs\\node.exe',
2018-02-27T21:31:50.2640480Z npm verb cli 'C:\\npm\\prefix\\node_modules\\npm\\bin\\npm-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
答案 0 :(得分:0)
在设置托管代理时,我修改了构建定义以包含环境变量NODE_ENV = production。当NODE_ENV环境变量设置为production时,npm将不会安装devDependencies中列出的模块。