{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/vsts-tasks/issues/4427","repository_url":"https://api.github.com/repos/Microsoft/vsts-tasks","labels_url":"https://api.github.com/repos/Microsoft/vsts-tasks/issues/4427/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/vsts-tasks/issues/4427/comments","events_url":"https://api.github.com/repos/Microsoft/vsts-tasks/issues/4427/events","html_url":"https://github.com/Microsoft/vsts-tasks/issues/4427","id":232489830,"number":4427,"title":"NPM Task sometimes hangs ","user":{"login":"mqlkmd","id":28260900,"avatar_url":"https://avatars1.githubusercontent.com/u/28260900?v=3","gravatar_id":"","url":"https://api.github.com/users/mqlkmd","html_url":"https://github.com/mqlkmd","followers_url":"https://api.github.com/users/mqlkmd/followers","following_url":"https://api.github.com/users/mqlkmd/following{/other_user}","gists_url":"https://api.github.com/users/mqlkmd/gists{/gist_id}","starred_url":"https://api.github.com/users/mqlkmd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mqlkmd/subscriptions","organizations_url":"https://api.github.com/users/mqlkmd/orgs","repos_url":"https://api.github.com/users/mqlkmd/repos","events_url":"https://api.github.com/users/mqlkmd/events{/privacy}","received_events_url":"https://api.github.com/users/mqlkmd/received_events","type":"User","site_admin":false},"labels":[{"id":407006537,"url":"https://api.github.com/repos/Microsoft/vsts-tasks/labels/Area:%20Packaging","name":"Area: Packaging","color":"5319e7","default":false}],"state":"open","locked":false,"assignee":{"login":"keithrob","id":908203,"avatar_url":"https://avatars2.githubusercontent.com/u/908203?v=3","gravatar_id":"","url":"https://api.github.com/users/keithrob","html_url":"https://github.com/keithrob","followers_url":"https://api.github.com/users/keithrob/followers","following_url":"https://api.github.com/users/keithrob/following{/other_user}","gists_url":"https://api.github.com/users/keithrob/gists{/gist_id}","starred_url":"https://api.github.com/users/keithrob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keithrob/subscriptions","organizations_url":"https://api.github.com/users/keithrob/orgs","repos_url":"https://api.github.com/users/keithrob/repos","events_url":"https://api.github.com/users/keithrob/events{/privacy}","received_events_url":"https://api.github.com/users/keithrob/received_events","type":"User","site_admin":false},"assignees":[{"login":"keithrob","id":908203,"avatar_url":"https://avatars2.githubusercontent.com/u/908203?v=3","gravatar_id":"","url":"https://api.github.com/users/keithrob","html_url":"https://github.com/keithrob","followers_url":"https://api.github.com/users/keithrob/followers","following_url":"https://api.github.com/users/keithrob/following{/other_user}","gists_url":"https://api.github.com/users/keithrob/gists{/gist_id}","starred_url":"https://api.github.com/users/keithrob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/keithrob/subscriptions","organizations_url":"https://api.github.com/users/keithrob/orgs","repos_url":"https://api.github.com/users/keithrob/repos","events_url":"https://api.github.com/users/keithrob/events{/privacy}","received_events_url":"https://api.github.com/users/keithrob/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2017-05-31T08:22:17Z","updated_at":"2017-05-31T12:45:04Z","closed_at":null,"body":"We are building an Angular2 application and use the VSTS \"npm Task\" for building and testing using Angular CLI.\r\nWe have recently experienced that the \"ng test\" step just hangs until the build timeouts. There are no error or debug information at all even though system.debug is turned on. This of course only happens on the build server - we can't reproduce it locally.\r\n\r\nTo investigate the issue we put the build on a private agent to get some more insight. Here, the build also hangs on the \"ng test\" step and when it happens no CPU is consumed so its not an endless loop or such.\r\nRunning the exact same step directly on the private agent in the cmd shell works fine, so it seems to be related to the agent/vsts-task. \r\n\r\nThe debug info from the build that causes the issue indicates that we are using the correct Node version:\r\n2017-05-30T09:28:11.2174577Z npm verb cli [ '**C:\\\\Program Files\\\\nodejs\\\\node.exe**',\r\n2017-05-30T09:28:11.2174577Z npm verb cli   'C:\\\\Program Files\\\\nodejs\\\\node_modules\\\\npm\\\\bin\\\\npm-cli.js',\r\n2017-05-30T09:28:11.2174577Z npm verb cli   'run',\r\n2017-05-30T09:28:11.2174577Z npm verb cli   'ci' ]\r\n2017-05-30T09:28:11.2174577Z npm info using npm@4.2.0\r\n2017-05-30T09:28:11.2174577Z npm info using **node@v7.10.0**\r\n\r\nBut when looking at the log in the agent's \"_diag\" folder for that same build, it indicates that another node binary is used:\r\n[2017-05-30 09:28:04Z INFO ProcessInvoker] Starting process:\r\n[2017-05-30 09:28:04Z INFO ProcessInvoker]   File name: '**C:\\AzureAgent02\\externals\\node\\bin\\node.exe**'\r\n[2017-05-30 09:28:04Z INFO ProcessInvoker]   Arguments: '\"C:\\AzureAgent02\\_work\\_tasks\\Npm_fe47e961-9fa8-4106-8639-368c022d43ad\\0.2.22\\npmtask.js\"'\r\n[2017-05-30 09:28:04Z INFO ProcessInvoker]   Working directory: 'C:\\AzureAgent02\\_work\\2\\s'\r\n[2017-05-30 09:28:04Z INFO ProcessInvoker]   Require exit code zero: 'True'\r\n[2017-05-30 09:28:04Z INFO ProcessInvoker]   Encoding web name: utf-8 ; code page: '65001'\r\n[2017-05-30 09:28:04Z INFO ProcessInvoker]   Force kill process on cancellation: 'False'\r\n[2017-05-30 09:28:04Z INFO ProcessInvoker] Process started with process id 2256, waiting for process exit.\r\n\r\nIf the \"ng test\" step is run with the agent's node binary in a cmd shell, it throws an exception because of a feature (js syntax) not yet available in that version of node (**v 5.10.1.0**).\r\n\r\nSo our workaround was to drop the \"npm Task\" and just use the \"Command Line Task\" directly which will use the globally installed node on the build server and not the one provided by the agent.\r\n\r\nIt seems like a bug, that the \"npm Task\" dont report back the exception that is actually thrown but just hangs infinitely.\r\n\r\nIf using the \"npm Task\", how can we force it to use the globally installed node or how can we update the agent's included node binary?"},"comment":{"url":"https://api.github.com/repos/Microsoft/vsts-tasks/issues/comments/305175987","html_url":"https://github.com/Microsoft/vsts-tasks/issues/4427#issuecomment-305175987","issue_url":"https://api.github.com/repos/Microsoft/vsts-tasks/issues/4427","id":305175987,"user":{"login":"bryanmacfarlane","id":919564,"avatar_url":"https://avatars0.githubusercontent.com/u/919564?v=3","gravatar_id":"","url":"https://api.github.com/users/bryanmacfarlane","html_url":"https://github.com/bryanmacfarlane","followers_url":"https://api.github.com/users/bryanmacfarlane/followers","following_url":"https://api.github.com/users/bryanmacfarlane/following{/other_user}","gists_url":"https://api.github.com/users/bryanmacfarlane/gists{/gist_id}","starred_url":"https://api.github.com/users/bryanmacfarlane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bryanmacfarlane/subscriptions","organizations_url":"https://api.github.com/users/bryanmacfarlane/orgs","repos_url":"https://api.github.com/users/bryanmacfarlane/repos","events_url":"https://api.github.com/users/bryanmacfarlane/events{/privacy}","received_events_url":"https://api.github.com/users/bryanmacfarlane/received_events","type":"User","site_admin":false},"created_at":"2017-05-31T12:45:04Z","updated_at":"2017-05-31T12:45:04Z","body":"The task was executed using internal node (expected - use to execute the task script)\r\n\r\nThe npm task ran your node installed on the box (not our internal one) to run npm\r\n\r\n```\r\n2017-05-30T09:28:04.9687469Z ##[debug]check path : C:\\Program Files\\nodejs\\npm.cmd\r\n2017-05-30T09:28:04.9687469Z ##[debug]npm=C:\\Program Files\\nodejs\\npm.cmd\r\n2017-05-30T09:28:04.9687469Z ##[debug]C:\\Program Files\\nodejs\\npm.cmd arg: run\r\n2017-05-30T09:28:04.9687469Z ##[debug]arguments=ci\r\n```\r\n\r\nIt's not using internal node to run npm.  It's hanging for another reason.\r\n\r\nDoes your tests use UI components?  Have you tried it by running an agent interactively (not as a service)?"}}
{"actor":{"display_login":"bryanmacfarlane"}}