为什么NPM Cache在TFS Build Server上使用EPERM随机失败?

时间:2016-07-08 19:45:01

标签: node.js tfs npm tfsbuild tfs2015

我正在使用TFS源代码控制和2015 TFS构建服务器。

我设置脚本以在构建服务器上构建。第一步是清除缓存,因为如果没有,它会因随机错误而随机失败。

但现在,差不多有一半的时间它会产生这个新错误:

2016-07-08T19:39:32.2041280Z > npm cache clean

2016-07-08T19:39:40.5819362Z npm ERR! Windows_NT 6.3.9600

2016-07-08T19:39:40.5819362Z npm ERR! argv "C:\\nodeJs\\node.exe" "C:\\nodeJs\\node_modules\\npm\\bin\\npm-cli.js" "cache" "clean"

2016-07-08T19:39:40.5819362Z npm ERR! node v4.4.7

2016-07-08T19:39:40.5819362Z npm ERR! npm  v2.15.8

2016-07-08T19:39:40.5819362Z npm ERR! path C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\npm-cache

2016-07-08T19:39:40.5819362Z npm ERR! code EPERM

2016-07-08T19:39:40.5819362Z npm ERR! errno -4048

2016-07-08T19:39:40.5819362Z npm ERR! syscall rmdir

2016-07-08T19:39:40.6288231Z npm ERR! Error: EPERM: operation not permitted, rmdir 'C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\npm-cache'

2016-07-08T19:39:40.6288231Z npm ERR!     at Error (native)

2016-07-08T19:39:40.6288231Z npm ERR!  { [Error: EPERM: operation not permitted, rmdir 'C:\Windows\ServiceProfiles\NetworkService\AppData\Roaming\npm-cache']

2016-07-08T19:39:40.6288231Z npm ERR!   errno: -4048,

2016-07-08T19:39:40.6288231Z npm ERR!   code: 'EPERM',

2016-07-08T19:39:40.6288231Z npm ERR!   syscall: 'rmdir',

2016-07-08T19:39:40.6288231Z npm ERR!   path: 'C:\\Windows\\ServiceProfiles\\NetworkService\\AppData\\Roaming\\npm-cache' }

2016-07-08T19:39:40.6288231Z npm ERR! 

2016-07-08T19:39:40.6288231Z npm ERR! Please try running this command again as root/Administrator.

2016-07-08T19:39:40.6757133Z npm ERR! Please include the following file with any support request:

2016-07-08T19:39:40.6757133Z npm ERR!     C:\Work\9\s\Atlas.Prototype\src\starterproject\npm-debug.log

2016-07-08T19:39:40.7382460Z npm ERR! Windows_NT 6.3.9600

2016-07-08T19:39:40.7382460Z npm ERR! argv "C:\\nodeJs\\node.exe" "C:\\nodeJs\\node_modules\\npm\\bin\\npm-cli.js" "run" "cleancache"

2016-07-08T19:39:40.7382460Z npm ERR! node v4.4.7

2016-07-08T19:39:40.7382460Z npm ERR! npm  v2.15.8

2016-07-08T19:39:40.7382460Z npm ERR! code ELIFECYCLE

2016-07-08T19:39:40.7382460Z npm ERR! angular2@5.0.4-v1.0.0 cleancache: `npm cache clean`

2016-07-08T19:39:40.7382460Z npm ERR! Exit status 4294963248

2016-07-08T19:39:40.7382460Z npm ERR! 

2016-07-08T19:39:40.7382460Z npm ERR! Failed at the angular2@5.0.4-v1.0.0 cleancache script 'npm cache clean'.

2016-07-08T19:39:40.7382460Z npm ERR! This is most likely a problem with the angular2 package,

2016-07-08T19:39:40.7382460Z npm ERR! not with npm itself.

2016-07-08T19:39:40.7538723Z npm ERR! Tell the author that this fails on your system:

2016-07-08T19:39:40.7538723Z npm ERR!     npm cache clean

它如何才能提供"许可"运行时出错,但是再次运行时会成功,如果第三次再次运行则是随机的?

确保npm cache clean在100%的时间内取得成功的步骤是什么?

1 个答案:

答案 0 :(得分:0)

由于问题是随机的,可能不是由许可引起的。

尝试将npm升级到最新版本,以查看问题是否仍然存在。另外,正如@ Christian.K所提到的,您可以检查是否存在并行构建。