如何在VisualStudioTeamServices生成代理中正确运行NPM安装
我在为VisualStudioTeamServices(以前是VisualStudioOnline)中的自动生成设置NPM任务时遇到问题。有两个问题:如何在VisualStudioTeamServices生成代理中正确运行NPM安装,npm,azure-devops,Npm,Azure Devops,我在为VisualStudioTeamServices(以前是VisualStudioOnline)中的自动生成设置NPM任务时遇到问题。有两个问题: 缓存锁定错误(如下所示) 这是痛苦的缓慢-45分钟以上的十几个包裹 我添加了--cache参数,但这似乎没有帮助 npm install --dev --cache $(Agent.BuildDirectory)\b binaries文件夹似乎是缓存的合适位置,但老实说,我不确定。以下是一些文档: 我很感激你的建议 当前配置: Set wor
npm install --dev --cache $(Agent.BuildDirectory)\b
binaries文件夹似乎是缓存的合适位置,但老实说,我不确定。以下是一些文档:
我很感激你的建议
当前配置:
Set workingFolder to default: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.97.1\tasks\Npm\0.2.7
##[debug]check path : C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.97.1\tasks\Npm\0.2.7\task.json
##[debug]set resource file to: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.97.1\tasks\Npm\0.2.7\task.json
##[debug]system.culture=en-US
##[debug]check path : C:\Program Files\nodejs\npm.cmd
##[debug]npm=C:\Program Files\nodejs\npm.cmd
##[debug]cwd=C:\a\1\s\com.example.web
##[debug]path exists: C:\a\1\s\com.example.web
##[debug]command=install
##[debug]C:\Program Files\nodejs\npm.cmd arg: install
##[debug]arguments=--dev --cache C:\a\1\b
##[debug]C:\Program Files\nodejs\npm.cmd arg: --dev --cache C:\a\1\b
##[debug]exec tool: C:\Program Files\nodejs\npm.cmd
##[debug]Arguments:
##[debug] install
##[debug] --dev
##[debug] --cache
##[debug] C:\a\1\b
[command]C:\Program Files\nodejs\npm.cmd install --dev --cache C:\a\1\b
npm WARN deprecated graceful-fs@3.0.8: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
npm WARN deprecated sf-lint@1.0.2: Use eslint-config-simplifield instead.
npm WARN deprecated lodash@2.4.1: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated lodash@0.9.2: Grunt needs your help! See https://github.com/gruntjs/grunt/issues/1403.
npm ERR! addLocal Could not install C:\a\1\s\com.example.web\@shinnn\eslint-config@>=0.0.5 <0.0.6\fixtures
npm WARN deprecated phantomjs@2.1.3: Package renamed to phantomjs-prebuilt. Please update 'phantomjs' package references to 'phantomjs-prebuilt'
npm WARN peerDependencies The peer dependency qunitjs@^1.14.0 included from karma-qunit will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN package.json Dependency 'mocha' exists in both dependencies and devDependencies, using 'mocha@*' from dependencies
npm WARN package.json Dependency 'mocha' exists in both dependencies and devDependencies, using 'mocha@*' from dependencies
npm ERR! addLocal Could not install C:\a\1\s\com.example.web\@shinnn\eslint-config@>=0.0.4 <0.0.5\fixtures
> cson@1.6.2 preinstall C:\a\1\s\com.example.web\node_modules\gulp-uglify\node_modules\uglify-save-license\node_modules\grunt-replace\node_modules\applause\node_modules\cson
> node ./cyclic.js
npm WARN locking Error: EMFILE, open 'C:\a\1\b\_locks\strip-ansi-0bb45da2369f5768.lock.STALE.STALE.STALE'
npm WARN locking at Error (native)
npm WARN locking C:\a\1\b\_locks\strip-ansi-0bb45da2369f5768.lock failed { [Error: EMFILE, open 'C:\a\1\b\_locks\strip-ansi-0bb45da2369f5768.lock.STALE.STALE.STALE']
npm WARN locking errno: -4066,
npm WARN locking code: 'EMFILE',
npm WARN locking path: 'C:\\a\\1\\b\\_locks\\strip-ansi-0bb45da2369f5768.lock.STALE.STALE.STALE' }
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--dev" "--cache" "C:\\a\\1\\b"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
2016-03-30T14:15:17.4509244Z npm ERR! Attempt to unlock C:\a\1\s\com.example.web\node_modules\gulp-imagemin\node_modules\imagemin-pngquant\node_modules\pngquant-bin\node_modules\compare-size\node_modules\ava\node_modules\chalk\node_modules\strip-ansi, which hasn't been locked
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm WARN locking Error: EMFILE, open 'C:\a\1\b\_locks\ansi-styles-cedcc1e1e4774cd0.lock.STALE.STALE.STALE'
npm WARN locking at Error (native)
npm WARN locking C:\a\1\b\_locks\ansi-styles-cedcc1e1e4774cd0.lock failed { [Error: EMFILE, open 'C:\a\1\b\_locks\ansi-styles-cedcc1e1e4774cd0.lock.STALE.STALE.STALE']
npm WARN locking errno: -4066,
npm WARN locking code: 'EMFILE',
npm WARN locking path: 'C:\\a\\1\\b\\_locks\\ansi-styles-cedcc1e1e4774cd0.lock.STALE.STALE.STALE' }
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--dev" "--cache" "C:\\a\\1\\b"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! Attempt to unlock C:\a\1\s\com.example.web\node_modules\gulp-imagemin\node_modules\imagemin-pngquant\node_modules\pngquant-bin\node_modules\compare-size\node_modules\ava\node_modules\chalk\node_modules\ansi-styles, which hasn't been locked
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm WARN locking Error: EMFILE, open 'C:\a\1\b\_locks\has-ansi-819c7cca16ab7ac8.lock.STALE.STALE.STALE'
npm WARN locking at Error (native)
2016-03-30T14:15:17.5709240Z npm WARN locking C:\a\1\b\_locks\has-ansi-819c7cca16ab7ac8.lock failed { [Error: EMFILE, open 'C:\a\1\b\_locks\has-ansi-819c7cca16ab7ac8.lock.STALE.STALE.STALE']
生成控制台输出:
Set workingFolder to default: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.97.1\tasks\Npm\0.2.7
##[debug]check path : C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.97.1\tasks\Npm\0.2.7\task.json
##[debug]set resource file to: C:\LR\MMS\Services\Mms\TaskAgentProvisioner\Tools\agents\1.97.1\tasks\Npm\0.2.7\task.json
##[debug]system.culture=en-US
##[debug]check path : C:\Program Files\nodejs\npm.cmd
##[debug]npm=C:\Program Files\nodejs\npm.cmd
##[debug]cwd=C:\a\1\s\com.example.web
##[debug]path exists: C:\a\1\s\com.example.web
##[debug]command=install
##[debug]C:\Program Files\nodejs\npm.cmd arg: install
##[debug]arguments=--dev --cache C:\a\1\b
##[debug]C:\Program Files\nodejs\npm.cmd arg: --dev --cache C:\a\1\b
##[debug]exec tool: C:\Program Files\nodejs\npm.cmd
##[debug]Arguments:
##[debug] install
##[debug] --dev
##[debug] --cache
##[debug] C:\a\1\b
[command]C:\Program Files\nodejs\npm.cmd install --dev --cache C:\a\1\b
npm WARN deprecated graceful-fs@3.0.8: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
npm WARN deprecated sf-lint@1.0.2: Use eslint-config-simplifield instead.
npm WARN deprecated lodash@2.4.1: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated lodash@0.9.2: Grunt needs your help! See https://github.com/gruntjs/grunt/issues/1403.
npm ERR! addLocal Could not install C:\a\1\s\com.example.web\@shinnn\eslint-config@>=0.0.5 <0.0.6\fixtures
npm WARN deprecated phantomjs@2.1.3: Package renamed to phantomjs-prebuilt. Please update 'phantomjs' package references to 'phantomjs-prebuilt'
npm WARN peerDependencies The peer dependency qunitjs@^1.14.0 included from karma-qunit will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN package.json Dependency 'mocha' exists in both dependencies and devDependencies, using 'mocha@*' from dependencies
npm WARN package.json Dependency 'mocha' exists in both dependencies and devDependencies, using 'mocha@*' from dependencies
npm ERR! addLocal Could not install C:\a\1\s\com.example.web\@shinnn\eslint-config@>=0.0.4 <0.0.5\fixtures
> cson@1.6.2 preinstall C:\a\1\s\com.example.web\node_modules\gulp-uglify\node_modules\uglify-save-license\node_modules\grunt-replace\node_modules\applause\node_modules\cson
> node ./cyclic.js
npm WARN locking Error: EMFILE, open 'C:\a\1\b\_locks\strip-ansi-0bb45da2369f5768.lock.STALE.STALE.STALE'
npm WARN locking at Error (native)
npm WARN locking C:\a\1\b\_locks\strip-ansi-0bb45da2369f5768.lock failed { [Error: EMFILE, open 'C:\a\1\b\_locks\strip-ansi-0bb45da2369f5768.lock.STALE.STALE.STALE']
npm WARN locking errno: -4066,
npm WARN locking code: 'EMFILE',
npm WARN locking path: 'C:\\a\\1\\b\\_locks\\strip-ansi-0bb45da2369f5768.lock.STALE.STALE.STALE' }
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--dev" "--cache" "C:\\a\\1\\b"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
2016-03-30T14:15:17.4509244Z npm ERR! Attempt to unlock C:\a\1\s\com.example.web\node_modules\gulp-imagemin\node_modules\imagemin-pngquant\node_modules\pngquant-bin\node_modules\compare-size\node_modules\ava\node_modules\chalk\node_modules\strip-ansi, which hasn't been locked
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm WARN locking Error: EMFILE, open 'C:\a\1\b\_locks\ansi-styles-cedcc1e1e4774cd0.lock.STALE.STALE.STALE'
npm WARN locking at Error (native)
npm WARN locking C:\a\1\b\_locks\ansi-styles-cedcc1e1e4774cd0.lock failed { [Error: EMFILE, open 'C:\a\1\b\_locks\ansi-styles-cedcc1e1e4774cd0.lock.STALE.STALE.STALE']
npm WARN locking errno: -4066,
npm WARN locking code: 'EMFILE',
npm WARN locking path: 'C:\\a\\1\\b\\_locks\\ansi-styles-cedcc1e1e4774cd0.lock.STALE.STALE.STALE' }
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--dev" "--cache" "C:\\a\\1\\b"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! Attempt to unlock C:\a\1\s\com.example.web\node_modules\gulp-imagemin\node_modules\imagemin-pngquant\node_modules\pngquant-bin\node_modules\compare-size\node_modules\ava\node_modules\chalk\node_modules\ansi-styles, which hasn't been locked
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm WARN locking Error: EMFILE, open 'C:\a\1\b\_locks\has-ansi-819c7cca16ab7ac8.lock.STALE.STALE.STALE'
npm WARN locking at Error (native)
2016-03-30T14:15:17.5709240Z npm WARN locking C:\a\1\b\_locks\has-ansi-819c7cca16ab7ac8.lock failed { [Error: EMFILE, open 'C:\a\1\b\_locks\has-ansi-819c7cca16ab7ac8.lock.STALE.STALE.STALE']
将workingFolder设置为默认值:C:\LR\MMS\Services\MMS\TaskAgentProvisioner\Tools\agents\1.97.1\tasks\Npm\0.2.7
##[调试]检查路径:C:\LR\MMS\Services\MMS\TaskAgentProvisioner\Tools\agents\1.97.1\tasks\Npm\0.2.7\task.json
##[调试]将资源文件设置为:C:\LR\MMS\Services\MMS\TaskAgentProvisioner\Tools\agents\1.97.1\tasks\Npm\0.2.7\task.json
##[debug]system.culture=en US
##[调试]检查路径:C:\Program Files\nodejs\npm.cmd
##[debug]npm=C:\Program Files\nodejs\npm.cmd
##[debug]cwd=C:\a\1\s\com.example.web
##[调试]路径存在:C:\a\1\s\com.example.web
##[调试]命令=安装
##[调试]C:\Program Files\nodejs\npm.cmd参数:安装
##[debug]参数=--dev--cache C:\a\1\b
##[调试]C:\Program Files\nodejs\npm.cmd arg:--dev--cache C:\a\1\b
##[调试]执行工具:C:\Program Files\nodejs\npm.cmd
##[调试]参数:
##[调试]安装
##[调试]--开发人员
##[调试]--缓存
##[调试]C:\a\1\b
[命令]C:\ProgramFiles\nodejs\npm.cmd安装--dev--cache C:\a\1\b
npm警告已弃用-fs@3.0.8:fs版本3及之前的版本将在较新的节点版本上失败。请尽快更新到优雅的fs@^4.0.0。
npm警告不推荐的sf-lint@1.0.2:改为使用eslint config simplifield。
npm警告已弃用lodash@2.4.1:lodash@=0.0.5=0.0.4cson@1.6.2预安装C:\a\1\s\com.example.web\node\u modules\gulp uglify\node\u modules\uglify save license\node\u modules\grunt replace\node\u modules\paird\node\u modules\cson
>node./cyclic.js
npm警告锁定错误:EMFILE,打开'C:\a\1\b\\U locks\strip-ansi-0bb45da2369f5768.lock.STALE.STALE.STALE'
npm警告错误锁定(本机)
npm警告锁定C:\a\1\b\\ U locks\strip-ansi-0bb45da2369f5768.lock失败{[错误:EMFILE,打开'C:\a\1\b\\ U locks\strip-ansi-0bb45da2369f5768.lock.STALE.STALE.STALE']
npm警告锁定错误号:-4066,
npm警告锁定代码:“EMFILE”,
npm警告锁定路径:“C:\\a\\1\\b\\\\U locks\\strip-ansi-0bb45da2369f5768.lock.STALE.STALE.STALE'}
npm错误!Windows NT 6.3.9600
npm错误!argv“C:\\Program Files\\nodejs\\\node.exe”C:\\Program Files\\nodejs\\node\u modules\\npm\\bin\\npm cli.js“install”“--dev”“--cache”“C:\\a\\1\\b”
npm错误!节点v0.12.7
npm错误!npm v2.11.3
2016-03-30T14:15:17.4509244Z npm错误!尝试解锁未锁定的C:\a\1\s\com.example.web\node\u modules\gulp imagemin\node\u modules\imagemin pngquant\node\u modules\pngquant bin\node\u modules\compare size\node\u modules\ava\node\u modules\chalk\node\u modules\strip ansi
npm错误!
npm错误!如果需要帮助,您可以在以下位置报告此错误:
npm错误!
npm警告锁定错误:EMFILE,打开“C:\a\1\b\\U locks\ansi-styles-CEDC1E4774CD0.lock.STALE.STALE.STALE.STALE”
npm警告错误锁定(本机)
npm警告锁定C:\a\1\b\\U locks\ansi-styles-CEDC1E4774CD0.lock失败{[错误:EMFILE,打开'C:\a\1\b\\U locks\ansi-styles-CEDC1E4774CD0.lock.STALE.STALE.STALE']
npm警告锁定错误号:-4066,
npm警告锁定代码:“EMFILE”,
npm警告锁定路径:“C:\\a\\1\\b\\\\U locks\\ansi-styles-CEDC1E4774CD0.lock.STALE.STALE.STALE.STALE'}
npm错误!Windows NT 6.3.9600
npm错误!argv“C:\\Program Files\\nodejs\\\node.exe”C:\\Program Files\\nodejs\\node\u modules\\npm\\bin\\npm cli.js“install”“--dev”“--cache”“C:\\a\\1\\b”
npm错误!节点v0.12.7
npm错误!npm v2.11.3
npm错误!尝试解锁尚未锁定的C:\a\1\s\com.example.web\node\u modules\gulp imagemin\node\u modules\imagemin pngquant\node\u modules\pngquant bin\node\u modules\compare size\node\u modules\ava\node\u modules\chalk\node\u modules\ansi样式
npm错误!
npm错误!如果需要帮助,您可以在以下位置报告此错误:
npm错误!
npm警告锁定错误:EMFILE,打开'C:\a\1\b\\U locks\has-ansi-819c7cca16ab7ac8.lock.STALE.STALE.STALE'
npm警告错误锁定(本机)
2016-03-30T14:15:17.5709240Z npm警告锁定C:\a\1\b\\锁定\has-ansi-819c7cca16ab7ac8.lock失败{[错误:EMFILE,打开'C:\a\1\b\\锁定\has-ansi-819c7cca16ab7ac8.lock.STALE.STALE.STALE.STALE']
重新安装NPM解决了我的问题:
npm安装npm-g
具体来说,我在构建中添加了带圆圈的任务:
非常感谢您自己的回答:)您可以禁用此构建任务以节省未来构建的时间,直到再次需要它为止。出于好奇,使用此步骤和不使用此步骤在安装时间上有什么区别?我不记得在后续运行中有什么意义。我似乎找不到关于--dev和--cache标志的文档,可以吗给我一些建议?老实说,这些标志不应该是必要的——请看下面我的答案。全局更新NPM成功了。我明白了。我实际上是在尝试避免在每个构建上下载所有节点_模块,我认为缓存标志会有所帮助。我想全局安装NPM解决了锁定文件问题,但没有解决节点_模块重新下载问题?还试图不必在每个版本上安装node_modules文件夹,并且不希望它们成为工件的一部分。你知道如何做到这一点吗?@Philip-不知道,但我发现MS build支持团队非常有帮助。在构建页面中,单击“帮助”,然后按照支持链接进行操作,直到你记录一个问题。下面的你反应很快。