Azure-pipelines-tasks: Error: Npm failed with return code: 4294963248

Created on 6 Nov 2019  路  16Comments  路  Source: microsoft/azure-pipelines-tasks

Hello,
So many NPM failures across our web apps.

https://microsoft.visualstudio.com/Xbox.Ambassadors/_build?definitionId=43109&_a=summary

If I trigger it manually, it will pass but sometimes takes 1 or 2 or 3 manual triggers.

I see the issue was closed:
https://github.com/Microsoft/azure-pipelines-tasks/issues/6657

But given the amount of trouble this causes I am hoping there is something coming through

Thanks

Artifacts bug

Most helpful comment

@brunorenn thanks for that, I just added a new step (Node.js tool installer) in our pipeline to roll back the version, and it successfully ran two times already:

npm info using [email protected]
npm info using [email protected]

image

All 16 comments

Also I'm experiencing this issue. The fix is to relaunch the build and pray.

Any other work around here?

Thanks

None that I know. Usually takes 1-4 tries to get it to build.

I still experience this issue as well. It feels like it's a coinflip every time I rebuild to get it to build correctly.

I have the same problem with Pipeline for our React (TypeScript) app. During npm install (npm task v1.*) this problem appears not 100% runs fail, but enough to annoy some people... retrying the task with following solution: https://stackoverflow.com/questions/60819191/task-control-option-custom-condition-run-task-when-previous-failed-or-timed doesnt seems to help for that issue. Retrying the Job solves but it may take more than one attempt. This problem for this pipeline started on 14/3/2020.

2020-03-25T22:23:21.4087518Z 22952 error code EPERM
2020-03-25T22:23:21.4087589Z 22953 error syscall unlink
2020-03-25T22:23:21.4087668Z 22954 error path C:\agent2\_work\4\s\node_modules\.staging\typescript-4440ace9\lib\tsserverlibrary.d.ts
2020-03-25T22:23:21.4087755Z 22955 error errno -4048
2020-03-25T22:23:21.4087843Z 22956 error Error: EPERM: operation not permitted, unlink 'C:\agent2\_work\4\s\node_modules\.staging\typescript-4440ace9\lib\tsserverlibrary.d.ts'
2020-03-25T22:23:21.4087933Z 22956 error  { Error: EPERM: operation not permitted, unlink 'C:\agent2\_work\4\s\node_modules\.staging\typescript-4440ace9\lib\tsserverlibrary.d.ts'
2020-03-25T22:23:21.4088022Z 22956 error   cause:
2020-03-25T22:23:21.4088108Z 22956 error    { Error: EPERM: operation not permitted, unlink 'C:\agent2\_work\4\s\node_modules\.staging\typescript-4440ace9\lib\tsserverlibrary.d.ts'
2020-03-25T22:23:21.4088205Z 22956 error      errno: -4048,
2020-03-25T22:23:21.4088279Z 22956 error      code: 'EPERM',
2020-03-25T22:23:21.4088362Z 22956 error      syscall: 'unlink',
2020-03-25T22:23:21.4088446Z 22956 error      path: 'C:\\agent2\\_work\\4\\s\\node_modules\\.staging\\typescript-4440ace9\\lib\\tsserverlibrary.d.ts' },
2020-03-25T22:23:21.4088555Z 22956 error   stack: 'Error: EPERM: operation not permitted, unlink \'C:\\agent2\\_work\\4\\s\\node_modules\\.staging\\typescript-4440ace9\\lib\\tsserverlibrary.d.ts\'',
2020-03-25T22:23:21.4088628Z 22956 error   errno: -4048,
2020-03-25T22:23:21.4088715Z 22956 error   code: 'EPERM',
2020-03-25T22:23:21.4088790Z 22956 error   syscall: 'unlink',
2020-03-25T22:23:21.4088874Z 22956 error   path: 'C:\\agent2\\_work\\4\\s\\node_modules\\.staging\\typescript-4440ace9\\lib\\tsserverlibrary.d.ts',
2020-03-25T22:23:21.4088960Z 22956 error   parent: 's' }
2020-03-25T22:23:21.4089049Z 22957 error The operation was rejected by your operating system.
2020-03-25T22:23:21.4089129Z 22957 error It's possible that the file was already in use (by a text editor or antivirus),
2020-03-25T22:23:21.4089996Z 22957 error or that you lack permissions to access it.

I am also seeing these issues still as @LukaszGrela described. Workaround is just trying again- have you figured anything else out?

image

# Test "npm install" task
# Adjust this to be the name of the previous task (task we want to check status)
$taskName = "npm install"

$url = "$(System.TeamFoundationCollectionUri)$(System.TeamProject)/_apis/build/builds/$(Build.BuildId)/timeline?api-version=5.1"

$result = Invoke-RestMethod -Uri $url -Headers @{authorization = "Bearer $env:SYSTEM_ACCESSTOKEN"} -ContentType "application/json" -Method get

#Get the previous task's result  
$taskResult = $result.records | where {$_.name -eq "npm install"} | select result  

echo "${taskName} result: $($taskResult.result)"

#set the Task B's taskResult to variable taskStatus
echo "##vso[task.setvariable variable=taskStatus]$($taskResult.result)"

Then 2nd line npm install task has the Custom Control Options test
and(not(canceled()), ne(variables.taskStatus, 'succeeded'))

I also have the npm cache clean --force task with the same control options

This doesnt solve all the failures, but it reduces the number of job fails:)

This problem is popped up for us since yesterday. Now almost all our builds are failing :(

@P-de-Jong I tried many things, but only solved when I returned my npm version to 6.13.0.

I'm getting exactly the same error since yesterday. If you keep re-trying it eventually succeeds. Around three failed builds before you manage to get a success through the pipeline. No issues on local dev machine when running ng serve, npm install, or npm update.

Same error here.
NPM Version: 6.13.4

Same here as well (6.14.4), ever since the 23th of April, about 80% of our CIs failed - last Friday not a single one succeeded. Changing from npm to yarn didn't help either.

@brunorenn thanks for that, I just added a new step (Node.js tool installer) in our pipeline to roll back the version, and it successfully ran two times already:

npm info using [email protected]
npm info using [email protected]

image

Yes, this happened a couple months ago. I added in npm cache clean --force and it reduced the number of failed builds substantially, however didn't treat the root cause. FYI, it looks like it's a npm race condition issue.

Closing as this is an issue with npm and/or node itself, not with the Pipelines task

@jmyersmsft When using the same node version locally, I experience no failures on npm install, while it's an intermittent failure on the pipeline job

Hi all,i am a newbie to react native,2 days ago ,i stucked while solving the issue,issue is same as @LukaszGrela LukaszGrela said ,same exact issue on that image i am facing,issue came while installing the this expo cmd "npm i -g expo-cli",i tried several solutions like npm cache clean --force ,replace the npm v.6.13.7,,node version t,13.11.0,and delete the node_modules,package-lock.json but still i didn't solve that issue.some buddy help me to solve this isssue,Thank you guys.

Was this page helpful?
0 / 5 - 0 ratings