簡體   English   中英

npm java軟件包未安裝

[英]npm java package not getting installed

npm Java軟件包未安裝。 現在已經嘗試了一個多星期,但沒有成功。
我已經安裝了Visual Studio Express 2013 for WindowsVisual Studio Express 2013 for Windows
我還安裝了Python v2.7
我的regedit當前Java版本設置為1.7
在安裝之前,我做了一個npm config set msvs_version 2013 ,然后我做了npm install java ,它拋出了錯誤:

> java@0.7.2 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! java@0.7.2 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the java@0.7.2 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
/
> java@0.7.2 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! java@0.7.2 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the java@0.7.2 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版本,因為我們的客戶端希望我們使用它的版本。
請幫忙!

找到了解決方法。
有時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兼容。
之后,在User Environment VariableSystem Environment Variable中設置MSBuild.exepath 對我來說,路徑是C:\\Program Files\\MSBuild\\12.0\\Bin 附加以“;”開頭的路徑 ;C:\\Program Files\\MSBuild\\12.0\\Bin
現在運行npm install java 它應該工作。

這是我所遇到的同類問題的解決方案……應該可以。

在管理員特權的命令提示符窗口中

npm install -g node-gyp
npm install --global --production windows-build-tools 
npm update 
npm install java

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM