在Windows上,npm安装随机失败

在我们的Windows生成服务器上运行npm install时,命令间歇性地失败

 error errno: -4048, error code: 'EPERM', error path: 'C:\\Users\\bamboo\\AppData\\Roaming\\npm-cache\\readable-stream\\1.0.33\\package\\package.json', error parent: 'through2' } error Please try running this command again as root/Administrator. 

即使命令正在以pipe理员身份运行的命令提示符下以pipe理员身份执行。 命令失败的软件包每次都不一样,其他Windows计算机在运行具有相同源的npm install时不存在此问题。

我已经尝试npm cache clean和手动删除C:\用户\%用户名%\ AppData \ npmcaching目录的内容,没有运气。 我还检查了npm-cache目录,NodeJS安装目录和包含源代码签出的目录的权限,并且都显示pipe理员组具有完全权限,并且pipe理员用户(正在运行npm install命令)拥有目录。 我也尝试了最新版本的npm(2.13.4),以及旧版本(2.11.3)。

什么导致这个权限错误?

以下是npm-debug.log文件的内容:

 236980 info install write-file-atomic@1.1.2 236981 info postinstall write-file-atomic@1.1.2 236982 info install npm@2.13.4 236983 info postinstall npm@2.13.4 236984 verbose unlock done using C:\Users\bamboo\AppData\Roaming\npm-cache\_locks\npm-723363012edbbbaa.lock for c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web\node_modules\npm 236985 verbose stack Error: EPERM, rename 'C:\Users\bamboo\AppData\Roaming\npm-cache\readable-stream\1.0.33\package\package.json' 236985 verbose stack at Error (native) 236986 verbose cwd c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web 236987 error Windows_NT 6.3.9600 236988 error argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--msvs_version=2013" 236989 error node v0.12.7 236990 error npm v2.11.3 236991 error path C:\Users\bamboo\AppData\Roaming\npm-cache\readable-stream\1.0.33\package\package.json 236992 error code EPERM 236993 error errno -4048 236994 error Error: EPERM, rename 'C:\Users\bamboo\AppData\Roaming\npm-cache\readable-stream\1.0.33\package\package.json' 236994 error at Error (native) 236994 error { [Error: EPERM, rename 'C:\Users\bamboo\AppData\Roaming\npm-cache\readable-stream\1.0.33\package\package.json'] 236994 error errno: -4048, 236994 error code: 'EPERM', 236994 error path: 'C:\\Users\\bamboo\\AppData\\Roaming\\npm-cache\\readable-stream\\1.0.33\\package\\package.json', 236994 error parent: 'through2' } 236995 error Please try running this command again as root/Administrator. 236996 verbose exit [ -4048, true ] 236997 verbose unbuild node_modules\gulp-replace-task\node_modules\through2 236998 info preuninstall through2@0.6.5 236999 info uninstall through2@0.6.5 237000 verbose unbuild rmStuff through2@0.6.5 from c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web\node_modules 237001 verbose unbuild rmStuff in c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web\node_modules\gulp-replace-task\node_modules 237002 info postuninstall through2@0.6.5 237003 silly gentlyRm c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web\node_modules\gulp-replace-task\node_modules\through2 is being purged from base c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web 237004 verbose gentlyRm don't care about contents; nuking c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web\node_modules\gulp-replace-task\node_modules\through2 237005 silly vacuum-fs purging c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web\node_modules\gulp-replace-task\node_modules\through2 237006 silly vacuum-fs quitting because other entries in c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web\node_modules\gulp-replace-task\node_modules 237007 verbose unbuild node_modules\browser-sync\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\utf-8-validate 237008 info preuninstall utf-8-validate@1.1.0 237009 info uninstall utf-8-validate@1.1.0 237010 verbose unbuild rmStuff utf-8-validate@1.1.0 from c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web\node_modules 237011 verbose unbuild rmStuff in c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web\node_modules\browser-sync\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules 237012 info postuninstall utf-8-validate@1.1.0 237013 silly gentlyRm c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web\node_modules\browser-sync\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\utf-8-validate is being purged from base c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web 237014 verbose gentlyRm don't care about contents; nuking c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web\node_modules\browser-sync\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\utf-8-validate 237015 silly vacuum-fs purging c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web\node_modules\browser-sync\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\utf-8-validate 237016 silly vacuum-fs quitting because other entries in c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web\node_modules\browser-sync\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules 237017 verbose unbuild node_modules\browser-sync\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\bufferutil 237018 info preuninstall bufferutil@1.1.0 237019 info uninstall bufferutil@1.1.0 237020 verbose unbuild rmStuff bufferutil@1.1.0 from c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web\node_modules 237021 verbose unbuild rmStuff in c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web\node_modules\browser-sync\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules 237022 info postuninstall bufferutil@1.1.0 237023 silly gentlyRm c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web\node_modules\browser-sync\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\bufferutil is being purged from base c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web 237024 verbose gentlyRm don't care about contents; nuking c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web\node_modules\browser-sync\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\bufferutil 237025 silly vacuum-fs purging c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web\node_modules\browser-sync\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules\bufferutil 237026 silly vacuum-fs quitting because other entries in c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web\node_modules\browser-sync\node_modules\socket.io\node_modules\socket.io-client\node_modules\engine.io-client\node_modules\ws\node_modules 237027 verbose unbuild node_modules\gulp-replace-task 237028 info preuninstall gulp-replace-task@0.1.0 237029 info uninstall gulp-replace-task@0.1.0 237030 verbose unbuild rmStuff gulp-replace-task@0.1.0 from c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web\node_modules 237031 info postuninstall gulp-replace-task@0.1.0 237032 silly gentlyRm c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web\node_modules\gulp-replace-task is being purged from base c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web 237033 verbose gentlyRm don't care about contents; nuking c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web\node_modules\gulp-replace-task 237034 silly vacuum-fs purging c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web\node_modules\gulp-replace-task 237035 silly vacuum-fs quitting because other entries in c:\bamboo-home\xml-data\build-dir\SB-MB-JOB1\Web\node_modules 

我遇到了同样的错误…我看到你也使用竹子。 所以。 你使用Node.js插件的竹? 检查设置 – >插件 – >查找新插件。

在任务设置中,选择键入“NPM”并最大化“高级设置”选项卡。 选择“使用独立的缓存”。 它可能会慢一些,因为它必须将所有内容复制到缓存中,但是Bamboo在您的竹主目录中创建该目录。

从那以后我没有得到这个错误。 为我工作