npm install -g karma error MSB4019: il progetto importato “C: \ Microsoft.Cpp.Default.props” non è stato trovato

Ho esaminato AngularJS e seguendo i suoi passaggi di installazione, ma ricevo un errore durante il passaggio n. 1:

npm install -g karma 

Ecco l’output completo:

 Microsoft Windows [Version 6.2.9200] (c) 2012 Microsoft Corporation. All rights reserved. C:\Users\Travis>node --version v0.10.18 C:\Users\Travis>python --version Python 2.7.3 C:\Users\Travis>npm install -g karma npm http GET https://registry.npmjs.org/karma npm http 304 https://registry.npmjs.org/karma npm http GET https://registry.npmjs.org/di npm http GET https://registry.npmjs.org/socket.io npm http GET https://registry.npmjs.org/chokidar npm http GET https://registry.npmjs.org/coffee-script npm http GET https://registry.npmjs.org/http-proxy npm http GET https://registry.npmjs.org/colors/0.6.0-1 npm http GET https://registry.npmjs.org/rimraf npm http GET https://registry.npmjs.org/minimatch npm http GET https://registry.npmjs.org/mime npm http GET https://registry.npmjs.org/useragent npm http GET https://registry.npmjs.org/graceful-fs npm http GET https://registry.npmjs.org/lodash npm http GET https://registry.npmjs.org/log4js npm http GET https://registry.npmjs.org/q npm http GET https://registry.npmjs.org/glob npm http GET https://registry.npmjs.org/connect npm http GET https://registry.npmjs.org/optimist npm http 304 https://registry.npmjs.org/socket.io npm http 304 https://registry.npmjs.org/di npm http 304 https://registry.npmjs.org/chokidar npm http 304 https://registry.npmjs.org/coffee-script npm http 304 https://registry.npmjs.org/colors/0.6.0-1 npm http 304 https://registry.npmjs.org/http-proxy npm http 304 https://registry.npmjs.org/rimraf npm http 304 https://registry.npmjs.org/minimatch npm http 304 https://registry.npmjs.org/mime npm http 304 https://registry.npmjs.org/useragent npm http 304 https://registry.npmjs.org/graceful-fs npm http 304 https://registry.npmjs.org/lodash npm http 304 https://registry.npmjs.org/log4js npm http 304 https://registry.npmjs.org/q npm http 304 https://registry.npmjs.org/glob npm http 304 https://registry.npmjs.org/connect npm http 304 https://registry.npmjs.org/optimist npm http GET https://registry.npmjs.org/lru-cache npm http GET https://registry.npmjs.org/sigmund npm http GET https://registry.npmjs.org/inherits npm http GET https://registry.npmjs.org/wordwrap npm http GET https://registry.npmjs.org/socket.io-client/0.9.16 npm http GET https://registry.npmjs.org/policyfile/0.0.4 npm http GET https://registry.npmjs.org/base64id/0.1.0 npm http GET https://registry.npmjs.org/redis/0.7.3 npm http 304 https://registry.npmjs.org/sigmund npm http 304 https://registry.npmjs.org/lru-cache npm http 304 https://registry.npmjs.org/policyfile/0.0.4 npm http 304 https://registry.npmjs.org/base64id/0.1.0 npm http 304 https://registry.npmjs.org/wordwrap npm http 304 https://registry.npmjs.org/redis/0.7.3 npm http 304 https://registry.npmjs.org/inherits npm http 304 https://registry.npmjs.org/socket.io-client/0.9.16 npm http GET https://registry.npmjs.org/pkginfo npm http GET https://registry.npmjs.org/utile npm http GET https://registry.npmjs.org/qs/0.6.5 npm http GET https://registry.npmjs.org/cookie-signature/1.0.1 npm http GET https://registry.npmjs.org/formidable/1.0.14 npm http GET https://registry.npmjs.org/cookie/0.1.0 npm http GET https://registry.npmjs.org/buffer-crc32/0.2.1 npm http GET https://registry.npmjs.org/send/0.1.4 npm http GET https://registry.npmjs.org/bytes/0.2.0 npm http GET https://registry.npmjs.org/fresh/0.2.0 npm http GET https://registry.npmjs.org/pause/0.0.1 npm http GET https://registry.npmjs.org/uid2/0.0.2 npm http GET https://registry.npmjs.org/debug npm http GET https://registry.npmjs.org/methods/0.0.1 npm http 304 https://registry.npmjs.org/pkginfo npm http 304 https://registry.npmjs.org/utile npm http 304 https://registry.npmjs.org/qs/0.6.5 npm http 304 https://registry.npmjs.org/cookie/0.1.0 npm http 304 https://registry.npmjs.org/cookie-signature/1.0.1 npm http 304 https://registry.npmjs.org/buffer-crc32/0.2.1 npm http 304 https://registry.npmjs.org/send/0.1.4 npm http 304 https://registry.npmjs.org/bytes/0.2.0 npm http 304 https://registry.npmjs.org/fresh/0.2.0 npm http 304 https://registry.npmjs.org/pause/0.0.1 npm http 304 https://registry.npmjs.org/formidable/1.0.14 npm http 304 https://registry.npmjs.org/uid2/0.0.2 npm http 304 https://registry.npmjs.org/debug npm http 304 https://registry.npmjs.org/methods/0.0.1 npm http GET https://registry.npmjs.org/range-parser/0.0.4 npm http GET https://registry.npmjs.org/i npm http GET https://registry.npmjs.org/mkdirp npm http GET https://registry.npmjs.org/deep-equal npm http GET https://registry.npmjs.org/ncp npm http GET https://registry.npmjs.org/async npm http 304 https://registry.npmjs.org/range-parser/0.0.4 npm http 304 https://registry.npmjs.org/deep-equal npm http 304 https://registry.npmjs.org/ncp npm http 304 https://registry.npmjs.org/async npm http GET https://registry.npmjs.org/dequeue/1.0.3 npm http GET https://registry.npmjs.org/async/0.1.15 npm http GET https://registry.npmjs.org/semver npm http 304 https://registry.npmjs.org/mkdirp npm http 304 https://registry.npmjs.org/i npm http GET https://registry.npmjs.org/readable-stream npm http 304 https://registry.npmjs.org/dequeue/1.0.3 npm http 304 https://registry.npmjs.org/async/0.1.15 npm http 304 https://registry.npmjs.org/readable-stream npm http 304 https://registry.npmjs.org/semver npm http GET https://registry.npmjs.org/xmlhttprequest/1.4.2 npm http GET https://registry.npmjs.org/uglify-js/1.2.5 npm http GET https://registry.npmjs.org/ws npm http GET https://registry.npmjs.org/active-x-obfuscator/0.0.1 npm http 304 https://registry.npmjs.org/xmlhttprequest/1.4.2 npm http 304 https://registry.npmjs.org/uglify-js/1.2.5 npm http 304 https://registry.npmjs.org/active-x-obfuscator/0.0.1 npm http 304 https://registry.npmjs.org/ws npm http GET https://registry.npmjs.org/zeparser/0.0.5 npm http 304 https://registry.npmjs.org/zeparser/0.0.5 npm http GET https://registry.npmjs.org/tinycolor npm http GET https://registry.npmjs.org/commander npm http GET https://registry.npmjs.org/nan npm http GET https://registry.npmjs.org/options npm http 304 https://registry.npmjs.org/nan npm http 304 https://registry.npmjs.org/options npm http 304 https://registry.npmjs.org/commander npm http 304 https://registry.npmjs.org/tinycolor > [email protected] install C:\Users\Travis\AppData\Roaming\npm\node_modules\karma\node_modules\socket.io\node_modules\socket.io -client\node_modules\ws > (node-gyp rebuild 2> builderror.log) || (exit 0) C:\Users\Travis\AppData\Roaming\npm\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_modules \ws>node "C:\Program Files (x86)\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch. C:\Users\Travis\AppData\Roaming\npm\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_module s\ws\build\bufferutil.vcxproj(18,3): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found . Confirm that the path in the  declaration is correct, and that the file exists on disk. C:\Users\Travis\AppData\Roaming\npm\node_modules\karma\node_modules\socket.io\node_modules\socket.io-client\node_module s\ws\build\validation.vcxproj(18,3): error MSB4019: The imported project "C:\Microsoft.Cpp.Default.props" was not found . Confirm that the path in the  declaration is correct, and that the file exists on disk. C:\Users\Travis\AppData\Roaming\npm\karma -> C:\Users\Travis\AppData\Roaming\npm\node_modules\karma\bin\karma [email protected] C:\Users\Travis\AppData\Roaming\npm\node_modules\karma ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ([email protected], [email protected]) ├── [email protected] ([email protected]) ├── [email protected] ([email protected]) ├── [email protected] ├── us[email protected] ([email protected]) ├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], b [email protected], [email protected], [email protected], [email protected], [email protected]) ├── [email protected] ([email protected], [email protected]) ├── [email protected] ([email protected], [email protected], [email protected], [email protected]) └── [email protected] ([email protected], [email protected], [email protected], [email protected]) 

Sembra che la versione di MSBuild in esecuzione (12.0, credo) non $(VCTargetsPath) correttamente la variabile $(VCTargetsPath) nel file vcxproj .

Ho avuto lo stesso problema con gli altri moduli dopo aver installato VS Express 2013 per il web insieme a VS Express 2012 per Windows. La soluzione era installare VS 2013 per Windows e utilizzare lo switch

 npm install --msvs_version=2013 

Per quelli che ancora incappano in errori dopo aver installato un VS con Windows SDK e provato la soluzione di Besrl, in particolare il node-gyp fallisce con

Error MSB4019: The imported project "X:\Microsoft.Cpp.Default.props" was not found ,

Prova a eseguire i comandi di npm install da un prompt dei comandi di MSVS.

Trovalo nel Start menu > Microsoft Visual Studio 201X > Visual Studio Tools > Open Visual Studio 201X Tools Command Prompt oppure esegui \\Common7\Tools\VsDevCmd.bat da un prompt dei comandi.

Quanto sopra ha funzionato per me con VS2012 e questo commento di Github mi ha aiutato a trovarlo.

Assicurati di avere tutto il software necessario per eseguire node-gyp :

È ansible configurare la versione di Visual Studio utilizzata da gyp tramite una variabile di ambiente in modo da evitare di dover impostare la proprietà --msvs_version=2012 per le installazioni future.

Esempi:

  • imposta GYP_MSVS_VERSION=2012 per Visual Studio 2012
  • imposta GYP_MSVS_VERSION=2013e (la ‘e’ sta per ‘express edition’)

Per l’elenco completo, vedere: https://github.com/joyent/node/blob/v0.10.29/tools/gyp/pylib/gyp/MSVSVersion.py#L209-294

Ciò è ancora doloroso per gli utenti Windows di NodeJS in quanto assume che sia installata una copia di Python e Visual Studio, ma molti utenti finali non ne avranno mai. Quindi faccio pressione su Joyent per incoraggiarli a includere i socket Web come parte del nodo CORE e anche a spedire un compilatore GNU gcc come parte dell’installazione di NodeJS in modo da poter risolvere il problema in modo permanente.

Sentiti libero di aggiungere il tuo voto a:

Su Windows il modo più semplice che ho trovato per risolvere questo problema è installare gli strumenti windows-build come raccomandato dal README per node-gyd

 npm install --global --production windows-build-tools 

https://github.com/nodejs/node-gyp

In questo modo non ho dovuto confondermi con l’installazione di python o altri pacchetti dist.

Se non hai installato Visual Studio, allora hai sicuramente bisogno della risposta su https://stackoverflow.com/a/18779641/530967 .

Fondamentalmente è necessario installare alcune versioni di Visual Studio 2010 (la versione Express è gratuita), quindi l’SDK di Windows, quindi VS SP1, quindi un aggiornamento del compilatore VC ++, tutto in questo ordine. Dopo che questo problema dovrebbe scomparire (come ha fatto per me).