2016-03-30 17 views
8

Ho problemi durante la configurazione di un'attività NPM per una build automatizzata in Visual Studio Team Services (in precedenza Visual Studio Online). Esistono due problemi:Come eseguire correttamente l'installazione di NPM in Visual Studio Team Services Agente di creazione

  1. Errori di blocco della cache (indicati di seguito).
  2. È dolorosamente lento - 45+ minuti per una dozzina circa di pacchetti.

Ho aggiunto l'argomento --cache ma quello non sembra essere d'aiuto.

npm install --dev --cache $(Agent.BuildDirectory)\b 

La cartella dei binari sembra il posto giusto per la cache, ma sinceramente, non ne sono sicuro. Alcuni documentazione qui:

https://msdn.microsoft.com/Library/vs/alm/Build/scripts/variables#AgentVariables

Apprezzo qualsiasi consiglio ...

Config attuale:

enter image description here

Corporatura output della console:

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 [email protected]: graceful-fs version 3 and before will fail on newer node releases. Please update to [email protected]^4.0.0 as soon as possible. 
npm WARN deprecated [email protected]: Use eslint-config-simplifield instead. 
npm WARN deprecated [email protected]: [email protected]<3.0.0 is no longer maintained. Upgrade to [email protected]^4.0.0. 
npm WARN deprecated [email protected]: 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\[email protected]>=0.0.5 <0.0.6\fixtures 
npm WARN deprecated [email protected]: Package renamed to phantomjs-prebuilt. Please update 'phantomjs' package references to 'phantomjs-prebuilt' 
npm WARN peerDependencies The peer dependency [email protected]^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 '[email protected]*' from dependencies 
npm WARN package.json Dependency 'mocha' exists in both dependencies and devDependencies, using '[email protected]*' from dependencies 
npm ERR! addLocal Could not install C:\a\1\s\com.example.web\@shinnn\[email protected]>=0.0.4 <0.0.5\fixtures 
> [email protected] 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'] 
+0

io non riesco a trova la documentazione sui flag --dev e --cache, potresti darmi qualche suggerimento? – Spiff

+0

Onestamente, queste bandiere non dovrebbero essere necessarie - vedi la mia risposta qui sotto. L'aggiornamento a livello globale di NPM ha funzionato. – Brett

+0

Vedo. In realtà sto cercando di evitare di scaricare tutti i node_modules su ogni build e ho pensato che questo --cache flag avrebbe aiutato. Suppongo che l'installazione di npm abbia risolto globalmente il problema del file di blocco ma non il problema del redownload di node_modules? – Spiff

risposta

5

reinstallazione NPM risolto il mio problema:

npm installare NPM-g

In particolare, ho aggiunto il compito cerchiata alla mia generazione:

build image

+1

Grazie mille per la tua risposta :) – digaomatias

+0

Puoi disattivare questa attività di compilazione per risparmiare tempo sui build futuri fino a quando non è necessario nuovamente –