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

Created on 9 Mar 2018  路  27Comments  路  Source: microsoft/azure-pipelines-tasks

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 [email protected] No description
2018-03-09T16:13:15.4354603Z npm WARN [email protected] No repository field.
2018-03-09T16:13:15.4921431Z npm WARN [email protected] 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 [email protected]
2018-03-09T16:13:15.4939272Z 3 info using [email protected]
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 [email protected]
2018-03-09T16:13:15.4940154Z 7 info lifecycle [email protected]~preinstall: [email protected]

ArtifactsPackages bug

Most helpful comment

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

All 27 comments

323 is not the same issue (it wasn't on rename). You need to do what we did for that case.

If you can repo (it sounds like you can since you said very very luck to work) then you need to gather the npm debug log and file an npm issue. That's what we did for #323.

If it repros consistently / frequently for you then it's like a data shape + environment issue. For example, 323 was an npm failure with a deep dependency graphs with duplicates on slower I/O and only on first build a fresh VM where it's not protected by a cache (hosted build is fresh everytime).

If that's the case, then see the workarounds in that issue like using force or a private agent (could even be a VM).

This occurs for me intermittently using npm task and install. My Agent is running the latest LTS version of nodejs. The work around is to run the build again. No big deal, but for ci builds it's a pain.

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

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?

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.

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 [email protected] (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

Exact issue as well - 8/20/18

Hey guys, any updates of resolving this issue?

@bryanmacfarlane, is there any update on this issue?

@keithrob and @alexmullans - I think the issue is coming from npm and not the task.

@devaradhan and others on the thread: can you try disabling the npm task and adding a Command Line or PowerShell task that calls npm install? If that has the same issue, that will confirm @bryanmacfarlane's hypothesis that this is an issue with npm itself.

/cc @zjrunner

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.

@mattnedrich sorry about that. Getting a group together to look into it. Can you try the suggestion from my last comment and see if that reduces/removes the intermittent failures? Trying to narrow down if this is in the npm task or coming from npm.cmd.

Thanks for following up @alexmullans. I'll give it a shot and let you know what happens.

For us the solution has been to move our CI pipeline to YARN while developers currently keep using NPM.
No more issue so far...

We moved to running npm install via a Command Line task as @alexmullans suggested. Haven't seen any npm install related failures so far today, but I want to be cautious to claim that if fixed our issue, as it was intermittent. So far so good though.

2018-11-13T09:16:14.9423922Z Binary found at C:\Agent2_work\27\s\Client\node_modules\node-sass\vendor\win32-x64-57\binding.node
2018-11-13T09:16:14.9462139Z Testing binary
2018-11-13T09:16:15.0309369Z Binary is fine
2018-11-13T09:16:16.9245949Z npm ERR! path C:\Agent2_work\27\s\Client\node_modules\fsevents\node_modules
2018-11-13T09:16:16.9246207Z npm ERR! code EPERM
2018-11-13T09:16:16.9248576Z npm ERR! errno -4048
2018-11-13T09:16:16.9248874Z npm ERR! syscall scandir
2018-11-13T09:16:16.9263408Z npm ERR! Error: EPERM: operation not permitted, scandir 'C:\Agent2_work\27\s\Client\node_modules\fsevents\node_modules'
2018-11-13T09:16:16.9263621Z npm ERR! { Error: EPERM: operation not permitted, scandir 'C:\Agent2_work\27\s\Client\node_modules\fsevents\node_modules'
2018-11-13T09:16:16.9263799Z npm ERR! stack: 'Error: EPERM: operation not permitted, scandir \'C:\Agent2\_work\27\s\Client\node_modules\fsevents\node_modules\'',
2018-11-13T09:16:16.9263866Z npm ERR! errno: -4048,
2018-11-13T09:16:16.9264935Z npm ERR! code: 'EPERM',
2018-11-13T09:16:16.9265073Z npm ERR! syscall: 'scandir',
2018-11-13T09:16:16.9266489Z npm ERR! path: 'C:\Agent2\_work\27\s\Client\node_modules\fsevents\node_modules' }
2018-11-13T09:16:16.9266769Z npm ERR!
2018-11-13T09:16:16.9267811Z npm ERR! Please try running this command again as root/Administrator.
2018-11-13T09:16:17.0468549Z
2018-11-13T09:16:17.0469382Z npm ERR! A complete log of this run can be found in:
2018-11-13T09:16:17.0469529Z npm ERR! C:\Users\TfsService\AppData\Roamingnpm-cache_logs\2018-11-13T09_16_17_000Z-debug.log
2018-11-13T09:16:17.2208262Z ##[error]Cmd.exe exited with code '-4048'.
2018-11-13T09:16:17.2856529Z ##[section]Finishing: npm install

I have the same issue. I tried to use the NPM task with the old version or CMD line, but I got the same error.
Then I tried to use PowerShell with the command "npm install". worked for me.

@mattnedrich I assume since you haven't been back here in 21 days that has solved the issue for you?
I am experiencing the same issue painfully frequently so would be good to know if that works

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

image

Unfortunately this has not worked for me

2018-12-06T15:55:49.3341235Z ##[section]Starting: npm install
2018-12-06T15:55:49.3345734Z ==============================================================================
2018-12-06T15:55:49.3345877Z Task         : Command Line
2018-12-06T15:55:49.3345998Z Description  : Run a command line script using cmd.exe on Windows and bash on macOS and Linux.
2018-12-06T15:55:49.3346116Z Version      : 2.142.2
2018-12-06T15:55:49.3346201Z Author       : Microsoft Corporation
2018-12-06T15:55:49.3346315Z Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613735)
2018-12-06T15:55:49.3346440Z ==============================================================================
2018-12-06T15:55:50.1382435Z Generating script.
2018-12-06T15:55:50.1510496Z Script contents:
2018-12-06T15:55:50.1515618Z npm install
2018-12-06T15:55:50.2082455Z ##[command]"C:\Windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "D:\a\_temp\1cb582c1-fad4-46c1-af71-606aec4d4168.cmd""
2018-12-06T15:56:59.5301540Z npm WARN tarball tarball data for [email protected] (sha512-jw7P2z/h6aPT4AENXDGjcfHTu5CSqzsbZc6YlUIebTyBAq8XaKp78x7VcSh30xwSCcsu5irZkYZUSFP1MrAMbg==) seems to be corrupted. Trying one more time.
2018-12-06T15:57:31.9482226Z npm ERR! path D:\a\1\s\node_modules\.staging\typescript-f5c6f0c0\lib\tsserverlibrary.js
2018-12-06T15:57:32.9233635Z npm ERR! code EPERM
2018-12-06T15:57:32.9288816Z ##[error]Cmd.exe exited with code '-4048'.
2018-12-06T15:57:32.9302000Z npm ERR! errno -4048
2018-12-06T15:57:32.9302157Z npm ERR! syscall unlink
2018-12-06T15:57:32.9302301Z npm ERR! Error: EPERM: operation not permitted, unlink 'D:\a\1\s\node_modules\.staging\typescript-f5c6f0c0\lib\tsserverlibrary.js'
2018-12-06T15:57:32.9302458Z npm ERR!  { [Error: EPERM: operation not permitted, unlink 'D:\a\1\s\node_modules\.staging\typescript-f5c6f0c0\lib\tsserverlibrary.js']
2018-12-06T15:57:32.9302599Z npm ERR!   cause:
2018-12-06T15:57:32.9302738Z npm ERR!    { Error: EPERM: operation not permitted, unlink 'D:\a\1\s\node_modules\.staging\typescript-f5c6f0c0\lib\tsserverlibrary.js'
2018-12-06T15:57:32.9302906Z npm ERR!      errno: -4048,
2018-12-06T15:57:32.9302998Z npm ERR!      code: 'EPERM',
2018-12-06T15:57:32.9303109Z npm ERR!      syscall: 'unlink',
2018-12-06T15:57:32.9303214Z npm ERR!      path:
2018-12-06T15:57:32.9303327Z npm ERR!       'D:\\a\\1\\s\\node_modules\\.staging\\typescript-f5c6f0c0\\lib\\tsserverlibrary.js' },
2018-12-06T15:57:32.9303450Z npm ERR!   stack:
2018-12-06T15:57:32.9303591Z npm ERR!    'Error: EPERM: operation not permitted, unlink \'D:\\a\\1\\s\\node_modules\\.staging\\typescript-f5c6f0c0\\lib\\tsserverlibrary.js\'',
2018-12-06T15:57:32.9303711Z npm ERR!   errno: -4048,
2018-12-06T15:57:32.9303814Z npm ERR!   code: 'EPERM',
2018-12-06T15:57:32.9303918Z npm ERR!   syscall: 'unlink',
2018-12-06T15:57:32.9304006Z npm ERR!   path:
2018-12-06T15:57:32.9304132Z npm ERR!    'D:\\a\\1\\s\\node_modules\\.staging\\typescript-f5c6f0c0\\lib\\tsserverlibrary.js',
2018-12-06T15:57:32.9304257Z npm ERR!   parent: '@neworbit/momenta' }
2018-12-06T15:57:32.9304364Z npm ERR! 
2018-12-06T15:57:32.9304473Z npm ERR! The operation was rejected by your operating system.
2018-12-06T15:57:32.9304603Z npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
2018-12-06T15:57:32.9304730Z npm ERR! or that you lack permissions to access it.
2018-12-06T15:57:32.9304820Z npm ERR! 
2018-12-06T15:57:32.9304934Z npm ERR! If you believe this might be a permissions issue, please double-check the
2018-12-06T15:57:32.9305065Z npm ERR! permissions of the file and its containing directories, or try running
2018-12-06T15:57:32.9305183Z npm ERR! the command again as root/Administrator (though this is not recommended).
2018-12-06T15:57:32.9305268Z 
2018-12-06T15:57:32.9305359Z npm ERR! A complete log of this run can be found in:
2018-12-06T15:57:32.9305484Z npm ERR!     C:\npm\cache\_logs\2018-12-06T15_57_31_975Z-debug.log
2018-12-06T15:57:32.9319652Z ##[section]Finishing: npm install

I see 5.6 is in play here, has anyone found a newer thread than this: https://github.com/npm/npm/issues/17671 -- looks like there was a known npm race they thought they fixed as of 5.6 that may still be there. I see many others on there even more recent with the same error, some publish some restore, not much comment from the npm contributors.

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)

Getting the same issue. Will really appreciate if anyone comes up with a work-around

I resolved this by downgrading node to 8.11.1 and npm 5.6.0 - https://npm.community/t/issues-running-npm-install-from-azure-devops/5888

$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!

any news on this? i'm facing a similiar problem but with the "unlink" command instead of the "rename" command as described by the OP.

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!

Was this page helpful?
0 / 5 - 0 ratings