2016-08-24 3 views
0

npm Java пакет не устанавливается. Пробовал это уже неделю, но не успел.
Я установил Visual Studio Express 2013 for Windows.
У меня также есть Python v2.7.
Текущая версия Java в моем regedit установлена ​​в 1.7.
Перед установкой я сделал npm config set msvs_version 2013, то я npm install java и бросил ошибку:npm пакет java не устанавливается

> [email protected] install C:\Users\1060641\AppData\Roaming\npm\node_modules\java 
> node-gyp rebuild 

C:\Users\1060641\AppData\Roaming\npm\node_modules\java>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild) else (node rebuild) 
C:\Users\1060641\AppData\Roaming\npm\node_modules\java\build\binding.sln : error MSB3411: Could not load the Visual C++ component "VCBuild.exe". If the component is not installed, either 1) install the Microsoft Windows SDK for Windows Server 2008 and .NET Framework 3.5, or 2) install Microsoft Visual Studio 2008. 
gyp ERR! build error 
gyp ERR! stack Error: `msbuild` failed with exit code: 1 
gyp ERR! stack  at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:269:23) 
gyp ERR! stack  at ChildProcess.emit (events.js:110:17) 
gyp ERR! stack  at Process.ChildProcess._handle.onexit (child_process.js:1074:12) 
gyp ERR! System Windows_NT 6.1.7601 
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" 
gyp ERR! cwd C:\Users\1060641\AppData\Roaming\npm\node_modules\java 
gyp ERR! node -v v0.12.7 
gyp ERR! node-gyp -v v2.0.1 
gyp ERR! not ok 
npm ERR! Windows_NT 6.1.7601 
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "java" 
npm ERR! node v0.12.7 
npm ERR! npm v2.11.3 
npm ERR! code ELIFECYCLE 

npm ERR! [email protected] install: `node-gyp rebuild` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'. 
npm ERR! This is most likely a problem with the java package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  node-gyp rebuild 
npm ERR! You can get their info via: 
npm ERR!  npm owner ls java 
npm ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR!  C:\Users\1060641\Desktop\test\npm-debug.log 

Тогда я сделал npm install --msvs_version=2013.
Он снова бросил ошибку:

C:\Users\1060641\Desktop\test>npm install --msvs_version=2013 
npm ERR! install Couldn't read dependencies 
npm ERR! Windows_NT 6.1.7601 
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--msvs_version=2013" 
npm ERR! node v0.12.7 
npm ERR! npm v2.11.3 
npm ERR! path C:\Users\1060641\package.json 
npm ERR! code ENOPACKAGEJSON 
npm ERR! errno -4058 

npm ERR! package.json ENOENT, open 'C:\Users\1060641\package.json' 
npm ERR! package.json This is most likely not a problem with npm itself. 
npm ERR! package.json npm can't find a package.json file in your current directory. 

npm ERR! Please include the following file with any support request: 
npm ERR!  C:\Users\1060641\Desktop\test\npm-debug.log 

Затем я снова сделал npm install java --msvs_version=2013 --global.
Опять ошибка:

C:\Users\1060641\Desktop\test>npm install java --msvs_version=2013 --global 
/
> [email protected] install C:\Users\1060641\AppData\Roaming\npm\node_modules\java 
> node-gyp rebuild 


C:\Users\1060641\AppData\Roaming\npm\node_modules\java>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild) else (node rebuild) 
C:\Users\1060641\AppData\Roaming\npm\node_modules\java\build\binding.sln : error MSB3411: Could not load the Visual C++ component "VCBuild.exe". If the component is not installed, either 1) install the Microsoft Windows SDK for Windows Server 2008 and .NET Framework 3.5, or 2) install Microsoft Visual Studio 2008. 
gyp ERR! build error 
gyp ERR! stack Error: `msbuild` failed with exit code: 1 
gyp ERR! stack  at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:269:23) 
gyp ERR! stack  at ChildProcess.emit (events.js:110:17) 
gyp ERR! stack  at Process.ChildProcess._handle.onexit (child_process.js:1074:12) 
gyp ERR! System Windows_NT 6.1.7601 
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" 
gyp ERR! cwd C:\Users\1060641\AppData\Roaming\npm\node_modules\java 
gyp ERR! node -v v0.12.7 
gyp ERR! node-gyp -v v2.0.1 
gyp ERR! not ok 
npm ERR! Windows_NT 6.1.7601 
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "java" "--msvs_version=2013" "--global" 
npm ERR! node v0.12.7 
npm ERR! npm v2.11.3 
npm ERR! code ELIFECYCLE 

npm ERR! [email protected] install: `node-gyp rebuild` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'. 
npm ERR! This is most likely a problem with the java package, 
npm ERR! not with npm itself. 
npm ERR! Tell the author that this fails on your system: 
npm ERR!  node-gyp rebuild 
npm ERR! You can get their info via: 
npm ERR!  npm owner ls java 
npm ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR!  C:\Users\1060641\Desktop\test\npm-debug.log 

Интересно, что происходит не так.
Я использую версию узла 0.12.7
И версия node-gym, которую я установил, была последней. И в журнале ошибках, некоторая строка:

gyp ERR! node -v v0.12.7 
gyp ERR! node-gyp -v v2.0.1 
gyp ERR! not ok 

Я не хочу, чтобы обновить NodeJS версии, так как ее он версия, что наш клиент хочет нас использовать.
Пожалуйста, помогите!

ответ

0

Обнаружили ошибку.
Иногда параметр msvs_version установлен неправильно.
Сделал npm config list, чтобы проверить значение msvs_version.
Показан 2015. Изменил его: npm config set msvs_version 2013 и снова проверил значения: npm config list.
Установлен еще один пакет Microsoft Build tool 2013. Это совместимо с Visual Studio 2013 Express.
После этого установите path для MSBuild.exe в User Environment Variable, а также System Environment Variable. Для меня путь был C:\Program Files\MSBuild\12.0\Bin. Добавьте этот путь, начинающийся с символа ";" т.е. ;C:\Program Files\MSBuild\12.0\Bin.
Теперь запустите npm install java. Он должен работать.

0

Вот мое решение для той же проблемы, с которой я столкнулся ... Это должно сработать.

пробег

в привилегированном администратора окне командной строки

npm install -g node-gyp 
npm install --global --production windows-build-tools 
npm update 
npm install java 
Смежные вопросы