azure-pipelines-tasks: npm install task (not msbuild) fails with EPERM on hosted build

It looks like there are some problems with permissions while installing various packages over npm install.

When I run my build for the 1st time I received the following errors:

npm ERR! Error: EPERM, open 'C:\NPM\Cache\bb33797c-ache-minimatch-2-0-8-package-tgz.lock'
npm ERR! { [Error: EPERM, open 'C:\NPM\Cache\bb33797c-ache-minimatch-2-0-8-package-tgz.lock']
npm ERR! errno: 50,
npm ERR! code: 'EPERM',
npm ERR! path: 'C:\\NPM\\Cache\\bb33797c-ache-minimatch-2-0-8-package-tgz.lock' }
npm ERR! 

After that I just run my build for the 2nd time without any modifications and I got the following errors:

npm ERR! Error: EPERM, open 'C:\NPM\Cache\e360d466-Cache-inherits-2-0-1-package-tgz.lock'
npm ERR! { [Error: EPERM, open 'C:\NPM\Cache\e360d466-Cache-inherits-2-0-1-package-tgz.lock']
npm ERR! errno: 50,
npm ERR! code: 'EPERM',
npm ERR! path: 'C:\\NPM\\Cache\\e360d466-Cache-inherits-2-0-1-package-tgz.lock' }
npm ERR! 

I receiving that errors on VSO

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 102 (44 by maintainers)

Commits related to this issue

Most upvoted comments

Based on this thread, I may have found a workaround: first install npm@3, then run that using a Command Line task to do the actual npm install:

(npm task) -> npm install npm@3
(Command Line task) -> $(Build.SourcesDirectory)\[your project]\node_modules\.bin\npm.cmd

My npm install tasks finished successfully without having to restart it multiple times for the first time in months!