I am running a build process on an on-prem server with TFS 2017 and vNext. The build works, but it takes 20+ minutes. This is an application that does msbuild, ngc, yarn, and karma. I would be totally fine with leaving it the way it is except for the 20 minutes it takes. I found a way to reduce the build by at least 8 minutes by running two of the yarn scripts in parallel. I have been able to successfully run these two scripts in parallel on my laptop, on a VM, and directly on the build server (I remote into the server to do it). However, every attempt to make this work through vNext fails with the exact same error.
Here is the error:
2017-09-13T20:06:17.9961416Z 13 09 2017 15:06:13.808:ERROR [karma]: TypeError: Cannot read property 'profile' of null
2017-09-13T20:06:17.9961416Z at factoryCallback (D:\Agents\Agent1\_work\126\s\Src\BFY.Admin.Web\node_modules\webpack\lib\Compilation.js:269:13)
2017-09-13T20:06:17.9961416Z at factory (D:\Agents\Agent1\_work\126\s\Src\BFY.Admin.Web\node_modules\webpack\lib\NormalModuleFactory.js:253:5)
2017-09-13T20:06:17.9961416Z at applyPluginsAsyncWaterfall (D:\Agents\Agent1\_work\126\s\Src\BFY.Admin.Web\node_modules\webpack\lib\NormalModuleFactory.js:99:14)
2017-09-13T20:06:17.9961416Z at D:\Agents\Agent1\_work\126\s\Src\BFY.Admin.Web\node_modules\tapable\lib\Tapable.js:204:11
2017-09-13T20:06:17.9961416Z at NormalModuleFactory.params.normalModuleFactory.plugin (D:\Agents\Agent1\_work\126\s\Src\BFY.Admin.Web\node_modules\webpack\lib\CompatibilityPlugin.js:52:5)
2017-09-13T20:06:17.9961416Z at NormalModuleFactory.applyPluginsAsyncWaterfall (D:\Agents\Agent1\_work\126\s\Src\BFY.Admin.Web\node_modules\tapable\lib\Tapable.js:208:13)
2017-09-13T20:06:17.9961416Z at resolver (D:\Agents\Agent1\_work\126\s\Src\BFY.Admin.Web\node_modules\webpack\lib\NormalModuleFactory.js:74:11)
2017-09-13T20:06:17.9961416Z at process.nextTick (D:\Agents\Agent1\_work\126\s\Src\BFY.Admin.Web\node_modules\webpack\lib\NormalModuleFactory.js:205:8)
2017-09-13T20:06:17.9961416Z at _combinedTickCallback (internal/process/next_tick.js:67:7)
2017-09-13T20:06:17.9961416Z at process._tickCallback (internal/process/next_tick.js:98:9)
2017-09-13T20:06:17.9961416Z 13 09 2017 15:06:13.823:ERROR [karma]: TypeError: Cannot read property 'profile' of null
2017-09-13T20:06:17.9961416Z at factoryCallback (D:\Agents\Agent1\_work\126\s\Src\BFY.Admin.Web\node_modules\webpack\lib\Compilation.js:269:13)
2017-09-13T20:06:17.9961416Z at factory (D:\Agents\Agent1\_work\126\s\Src\BFY.Admin.Web\node_modules\webpack\lib\NormalModuleFactory.js:253:5)
2017-09-13T20:06:17.9961416Z at applyPluginsAsyncWaterfall (D:\Agents\Agent1\_work\126\s\Src\BFY.Admin.Web\node_modules\webpack\lib\NormalModuleFactory.js:99:14)
2017-09-13T20:06:17.9961416Z at D:\Agents\Agent1\_work\126\s\Src\BFY.Admin.Web\node_modules\tapable\lib\Tapable.js:204:11
2017-09-13T20:06:17.9961416Z at NormalModuleFactory.params.normalModuleFactory.plugin (D:\Agents\Agent1\_work\126\s\Src\BFY.Admin.Web\node_modules\webpack\lib\CompatibilityPlugin.js:52:5)
2017-09-13T20:06:17.9961416Z at NormalModuleFactory.applyPluginsAsyncWaterfall (D:\Agents\Agent1\_work\126\s\Src\BFY.Admin.Web\node_modules\tapable\lib\Tapable.js:208:13)
2017-09-13T20:06:17.9961416Z at resolver (D:\Agents\Agent1\_work\126\s\Src\BFY.Admin.Web\node_modules\webpack\lib\NormalModuleFactory.js:74:11)
2017-09-13T20:06:17.9961416Z at process.nextTick (D:\Agents\Agent1\_work\126\s\Src\BFY.Admin.Web\node_modules\webpack\lib\NormalModuleFactory.js:205:8)
2017-09-13T20:06:17.9961416Z at _combinedTickCallback (internal/process/next_tick.js:67:7)
2017-09-13T20:06:17.9961416Z at process._tickCallback (internal/process/next_tick.js:98:9)
The two scrips that are running are:
"test": "SET NODE_ENV=test&& karma start karma.conf.js"
and
"build:prod:aot": "rimraf aot && ngc -p ./tsconfig-aot.json && SET NODE_ENV=production&& webpack"
The error is coming from karma. I get the same error from vNext no matter how I try to run these two scripts. I have tried
- Adding a script to run them with the
concurrently
npm package. Executed using a Windows batch command. - Adding a script to run them with the
npm-run-all
npm package. Executed using a Windows batch command. - Running a powershell .ps1 script to run each command with Start-Job.
- Running a .bat file that in turn runs two other .bat files, one for each script.
In every case I get the exact same error from vNext. In every case I get the expected result when running from my laptop, a VM, and when running the script while logged into the build server.
What am I missing here? Why is vNext behaving differently?
cmd /c
and you should be OK.