azure-pipelines-tasks: npm.cmd failed with return code: 4294963238

Environment

  • Server - VSTS account name: DartContainer team project name: Web Development build definition name/build number: OTC Portals CI 2.0 / 6.28.1-beta.0

  • Hosted Agent - Hosted VS2017

Issue Description

npm task, install command, version 1.x

Transient failures (frequent all morning if you look at our other builds) installing NPM packages. Always fails with the return code listed above. NPM version is 5.6.0 which is what ships with Node 8.10.

If you’re very very lucky, queueing the build again may fix the problem, because it’s a transient failure.

There seems to be a known issue about this from a while ago, but which is reported fixed. (See #1205 and #323).

Error logs

(Project path names have been sanitized.)

2018-03-09T16:12:43.5340151Z ##[section]Starting: npm install SP
2018-03-09T16:12:43.5344840Z ==============================================================================
2018-03-09T16:12:43.5345158Z Task         : npm
2018-03-09T16:12:43.5345463Z Description  : Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Package Management.
2018-03-09T16:12:43.5345965Z Version      : 1.0.10
2018-03-09T16:12:43.5346184Z Author       : Microsoft Corporation
2018-03-09T16:12:43.5346448Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613746)
2018-03-09T16:12:43.5346756Z ==============================================================================
2018-03-09T16:12:43.9821935Z [command]C:\Windows\system32\cmd.exe /D /S /C "D:\a\_tool\node\8.10.0\x64\npm.cmd --version"
2018-03-09T16:12:44.8161801Z 5.6.0
2018-03-09T16:12:46.4171194Z [command]C:\Windows\system32\cmd.exe /D /S /C "D:\a\_tool\node\8.10.0\x64\npm.cmd config list"
2018-03-09T16:12:47.2913966Z ; cli configs
2018-03-09T16:12:47.2914588Z metrics-registry = "https://registry.npmjs.org/"
2018-03-09T16:12:47.2914907Z scope = ""
2018-03-09T16:12:47.2915175Z user-agent = "npm/5.6.0 node/v8.10.0 win32 x64"
2018-03-09T16:12:47.2915346Z 
2018-03-09T16:12:47.2915570Z ; environment configs
2018-03-09T16:12:47.2915814Z cache = "C:\\npm\\cache"
2018-03-09T16:12:47.2916056Z prefix = "C:\\npm\\prefix"
2018-03-09T16:12:47.2916315Z userconfig = "D:\\a\\1\\npm\\7210.npmrc"
2018-03-09T16:12:47.2916500Z 
2018-03-09T16:12:47.2916733Z ; node bin location = D:\a\_tool\node\8.10.0\x64\node.exe
2018-03-09T16:12:47.2917022Z ; cwd = D:\a\1\s\MyProject\MyProject.Web
2018-03-09T16:12:47.2917294Z ; HOME = C:\Users\VssAdministrator
2018-03-09T16:12:47.2917534Z ; "npm config ls -l" to show all defaults.
2018-03-09T16:12:47.2917708Z 
2018-03-09T16:12:47.2919963Z [command]C:\Windows\system32\cmd.exe /D /S /C "D:\a\_tool\node\8.10.0\x64\npm.cmd install"
2018-03-09T16:13:15.4313059Z npm WARN dartportal-otc@1.0.0 No description
2018-03-09T16:13:15.4354603Z npm WARN dartportal-otc@1.0.0 No repository field.
2018-03-09T16:13:15.4921431Z npm WARN dartportal-otc@1.0.0 No license field.
2018-03-09T16:13:15.4921600Z 
2018-03-09T16:13:15.4922060Z npm ERR! path D:\a\1\s\MyProject\MyProject.Web\node_modules\requirejs\bin\r.js.3170253953
2018-03-09T16:13:15.4922328Z npm ERR! code EPERM
2018-03-09T16:13:15.4922524Z npm ERR! errno -4048
2018-03-09T16:13:15.4922722Z npm ERR! syscall rename
2018-03-09T16:13:15.4923255Z npm ERR! Error: EPERM: operation not permitted, rename 'D:\a\1\s\MyProject\MyProject.Web\node_modules\requirejs\bin\r.js.3170253953' -> 'D:\a\1\s\MyProject\MyProject.Web\node_modules\requirejs\bin\r.js'
2018-03-09T16:13:15.4924728Z npm ERR!  { Error: EPERM: operation not permitted, rename 'D:\a\1\s\MyProject\MyProject.Web\node_modules\requirejs\bin\r.js.3170253953' -> 'D:\a\1\s\MyProject\MyProject.Web\node_modules\requirejs\bin\r.js'
2018-03-09T16:13:15.4925459Z npm ERR!   cause: 
2018-03-09T16:13:15.4925922Z npm ERR!    { Error: EPERM: operation not permitted, rename 'D:\a\1\s\MyProject\MyProject.Web\node_modules\requirejs\bin\r.js.3170253953' -> 'D:\a\1\s\MyProject\MyProject.Web\node_modules\requirejs\bin\r.js'
2018-03-09T16:13:15.4926387Z npm ERR!      errno: -4048,
2018-03-09T16:13:15.4926644Z npm ERR!      code: 'EPERM',
2018-03-09T16:13:15.4926888Z npm ERR!      syscall: 'rename',
2018-03-09T16:13:15.4927243Z npm ERR!      path: 'D:\\a\\1\\s\\MyProject\\MyProject.Web\\node_modules\\requirejs\\bin\\r.js.3170253953',
2018-03-09T16:13:15.4927830Z npm ERR!      dest: 'D:\\a\\1\\s\\MyProject\\MyProject.Web\\node_modules\\requirejs\\bin\\r.js' },
2018-03-09T16:13:15.4928274Z npm ERR!   stack: 'Error: EPERM: operation not permitted, rename \'D:\\a\\1\\s\\MyProject\\MyProject.Web\\node_modules\\requirejs\\bin\\r.js.3170253953\' -> \'D:\\a\\1\\s\\MyProject\\MyProject.Web\\node_modules\\requirejs\\bin\\r.js\'',
2018-03-09T16:13:15.4929651Z npm ERR!   errno: -4048,
2018-03-09T16:13:15.4929962Z npm ERR!   code: 'EPERM',
2018-03-09T16:13:15.4930151Z npm ERR!   syscall: 'rename',
2018-03-09T16:13:15.4930429Z npm ERR!   path: 'D:\\a\\1\\s\\MyProject\\MyProject.Web\\node_modules\\requirejs\\bin\\r.js.3170253953',
2018-03-09T16:13:15.4930764Z npm ERR!   dest: 'D:\\a\\1\\s\\MyProject\\MyProject.Web\\node_modules\\requirejs\\bin\\r.js',
2018-03-09T16:13:15.4931414Z npm ERR!   parent: 'dartportal-otc' }
2018-03-09T16:13:15.4931803Z npm ERR! 
2018-03-09T16:13:15.4932453Z npm ERR! Please try running this command again as root/Administrator.
2018-03-09T16:13:15.4932633Z 
2018-03-09T16:13:15.4932855Z npm ERR! A complete log of this run can be found in:
2018-03-09T16:13:15.4933153Z npm ERR!     C:\npm\cache\_logs\2018-03-09T16_13_15_368Z-debug.log
2018-03-09T16:13:15.4937658Z Found npm debug log, make sure the path matches with the one in npm's output: C:\npm\cache\_logs\2018-03-09T16_13_15_368Z-debug.log
2018-03-09T16:13:15.4938129Z 0 info it worked if it ends with ok
2018-03-09T16:13:15.4938365Z 1 verbose cli [ 'D:\\a\\_tool\\node\\8.10.0\\x64\\node.exe',
2018-03-09T16:13:15.4938639Z 1 verbose cli   'D:\\a\\_tool\\node\\8.10.0\\x64\\node_modules\\npm\\bin\\npm-cli.js',
2018-03-09T16:13:15.4938888Z 1 verbose cli   'install' ]
2018-03-09T16:13:15.4939074Z 2 info using npm@5.6.0
2018-03-09T16:13:15.4939272Z 3 info using node@v8.10.0
2018-03-09T16:13:15.4939472Z 4 verbose npm-session 46648d3d26ad6162
2018-03-09T16:13:15.4939699Z 5 silly install runPreinstallTopLevelLifecycles
2018-03-09T16:13:15.4939914Z 6 silly preinstall dartportal-otc@1.0.0
2018-03-09T16:13:15.4940154Z 7 info lifecycle dartportal-otc@1.0.0~preinstall: dartportal-otc@1.0.0

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 3
  • Comments: 29 (3 by maintainers)

Most upvoted comments

same issue here, please let me know if there is a better solution than retry and pray

Hello! I’m a PM over on the Azure Artifacts team. I wanted to drop in here and address some of these issues with the news that we’re currently reevaluating the types of tasks we offer in Azure Pipelines, and looking to focus more on lighter-weight tasks that cover authentication and setup. In lieu of the task redesign, we’re going to forego making changes to the current tasks (with a few exceptions). We hope the new tasks we spin up in the next quarter or so are easier and more helpful, be on the lookout!

Same issue here on npm install:

2018-08-03T15:33:15.2970556Z ##[section]Starting: npm install
2018-08-03T15:33:15.3283078Z ==============================================================================
2018-08-03T15:33:15.3283078Z Task         : npm
2018-08-03T15:33:15.3283078Z Description  : Run an npm command
2018-08-03T15:33:15.3283078Z Version      : 0.2.22
2018-08-03T15:33:15.3283078Z Author       : Microsoft Corporation
2018-08-03T15:33:15.3283078Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613746)
2018-08-03T15:33:15.3283078Z ==============================================================================
2018-08-03T15:33:16.7345645Z [command]C:\Program Files\nodejs\npm.cmd config list
2018-08-03T15:33:18.1251891Z ; cli configs
2018-08-03T15:33:18.1251891Z metrics-registry = "https://registry.npmjs.org/"
2018-08-03T15:33:18.1251891Z scope = ""
2018-08-03T15:33:18.1251891Z user-agent = "npm/6.2.0 node/v10.8.0 win32 x64"
2018-08-03T15:33:18.1251891Z 
2018-08-03T15:33:18.1251891Z ; builtin config undefined
2018-08-03T15:33:18.1251891Z prefix = "C:\\Users\\TFSUser\\AppData\\Roaming\\npm"
2018-08-03T15:33:18.1251891Z 
2018-08-03T15:33:18.1251891Z ; node bin location = C:\Program Files\nodejs\node.exe
2018-08-03T15:33:18.1251891Z ; cwd = D:\TFBuildWorks\51\s\ProLunch.Ng
2018-08-03T15:33:18.1251891Z ; HOME = C:\Users\TFSUser
2018-08-03T15:33:18.1251891Z ; "npm config ls -l" to show all defaults.
2018-08-03T15:33:18.1251891Z 
2018-08-03T15:33:18.1720627Z [command]C:\Program Files\nodejs\npm.cmd install
2018-08-03T15:38:17.8601572Z npm WARN tarball tarball data for devextreme@18.1.5 (sha1-AGqkrxR/tBRIAeLMjlIPiIVdw2Y=) seems to be corrupted. Trying one more time.
2018-08-03T15:42:27.6731389Z npm ERR! path D:\TFBuildWorks\51\s\ProLunch.Ng\node_modules\.staging\devextreme-cc2dcbe5\dist\js\dx.web.debug.js
2018-08-03T15:42:27.6731389Z npm ERR! code EPERM
2018-08-03T15:42:27.6731389Z npm ERR! errno -4048
2018-08-03T15:42:27.6731389Z npm ERR! syscall unlink
2018-08-03T15:42:27.6731389Z npm ERR! Error: EPERM: operation not permitted, unlink 'D:\TFBuildWorks\51\s\ProLunch.Ng\node_modules\.staging\devextreme-cc2dcbe5\dist\js\dx.web.debug.js'
2018-08-03T15:42:27.6731389Z npm ERR!  { [Error: EPERM: operation not permitted, unlink 'D:\TFBuildWorks\51\s\ProLunch.Ng\node_modules\.staging\devextreme-cc2dcbe5\dist\js\dx.web.debug.js']
2018-08-03T15:42:27.6731389Z npm ERR!   cause:
2018-08-03T15:42:27.6731389Z npm ERR!    { Error: EPERM: operation not permitted, unlink 'D:\TFBuildWorks\51\s\ProLunch.Ng\node_modules\.staging\devextreme-cc2dcbe5\dist\js\dx.web.debug.js'
2018-08-03T15:42:27.6731389Z npm ERR!      errno: -4048,
2018-08-03T15:42:27.6731389Z npm ERR!      code: 'EPERM',
2018-08-03T15:42:27.6731389Z npm ERR!      syscall: 'unlink',
2018-08-03T15:42:27.6731389Z npm ERR!      path:
2018-08-03T15:42:27.6731389Z npm ERR!       'D:\\TFBuildWorks\\51\\s\\ProLunch.Ng\\node_modules\\.staging\\devextreme-cc2dcbe5\\dist\\js\\dx.web.debug.js' },
2018-08-03T15:42:27.6731389Z npm ERR!   stack:
2018-08-03T15:42:27.6731389Z npm ERR!    'Error: EPERM: operation not permitted, unlink \'D:\\TFBuildWorks\\51\\s\\ProLunch.Ng\\node_modules\\.staging\\devextreme-cc2dcbe5\\dist\\js\\dx.web.debug.js\'',
2018-08-03T15:42:27.6731389Z npm ERR!   errno: -4048,
2018-08-03T15:42:27.6731389Z npm ERR!   code: 'EPERM',
2018-08-03T15:42:27.6731389Z npm ERR!   syscall: 'unlink',
2018-08-03T15:42:27.6731389Z npm ERR!   path:
2018-08-03T15:42:27.6731389Z npm ERR!    'D:\\TFBuildWorks\\51\\s\\ProLunch.Ng\\node_modules\\.staging\\devextreme-cc2dcbe5\\dist\\js\\dx.web.debug.js',
2018-08-03T15:42:27.6731389Z npm ERR!   parent: 'prolunch' }
2018-08-03T15:42:27.6731389Z npm ERR! 
2018-08-03T15:42:27.6887648Z npm ERR! The operation was rejected by your operating system.
2018-08-03T15:42:27.6887648Z npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
2018-08-03T15:42:27.6887648Z npm ERR! or that you lack permissions to access it.
2018-08-03T15:42:27.6887648Z npm ERR! 
2018-08-03T15:42:27.6887648Z npm ERR! If you believe this might be a permissions issue, please double-check the
2018-08-03T15:42:27.6887648Z npm ERR! permissions of the file and its containing directories, or try running
2018-08-03T15:42:27.6887648Z npm ERR! the command again as root/Administrator (though this is not recommended).
2018-08-03T15:42:27.8918886Z 
2018-08-03T15:42:27.9075147Z npm ERR! A complete log of this run can be found in:
2018-08-03T15:42:27.9075147Z npm ERR!     C:\Users\TFSUser\AppData\Roaming\npm-cache\_logs\2018-08-03T15_42_27_742Z-debug.log
2018-08-03T15:42:28.0950234Z ##[error]npm failed with error: C:\Program Files\nodejs\npm.cmd failed with return code: 4294963248

I’m also facing the same issue during CI build in VSTS for an Angular application. Is there any solution for it. The “npm install” task executes well but the “npm run-script build” fails.

@hisuwh We have not seen any npm install failures since changing to a Command Line task for the npm install step

image

We are observing the same intermittent failure when running the npm install step of our CI pipeline. Has there been any update on this? This issue makes running CI via Azure Pipelines almost unusable.

Since 6/29, I’ve seen nearly 50% failure rates on CI builds, for this NPM error. As @kentonbmax says, if you queue the build again, it usually works, but that’s a giant pain for a CI build you’re expecting to just work. What do you need from us to diagnose this and fix it?

$StopLoop = $false
[int]$RetryCount = 0

do {
    npm install
    Write-Host "Exit code $LASTEXITCODE"

    if ($LASTEXITCODE -eq 0) {
        Write-Host "Npm install complete"
        $StopLoop = $true

    } elseif ($RetryCount -gt 2) {
        Write-Host "Could not complete npm install after 3 attempts"
        $StopLoop = $true

    } else {
        Write-Host "Could not run npm install retrying in 5 seconds"
        Start-Sleep -Seconds 5
        $RetryCount = $RetryCount + 1
    }
}
While ($StopLoop -eq $false)

Man this helps me a lot!

We were experiencing this issue increasingly often and so have implemented a workaround using a powershell script to retry. This is not ideal obviously as it increases our build times

$StopLoop = $false
[int]$RetryCount = 0

do {
    npm install
    Write-Host "Exit code $LASTEXITCODE"

    if ($LASTEXITCODE -eq 0) {
        Write-Host "Npm install complete"
        $StopLoop = $true

    } elseif ($RetryCount -gt 2) {
        Write-Host "Could not complete npm install after 3 attempts"
        $StopLoop = $true

    } else {
        Write-Host "Could not run npm install retrying in 5 seconds"
        Start-Sleep -Seconds 5
        $RetryCount = $RetryCount + 1
    }
}
While ($StopLoop -eq $false)