2014-12-03 184 views
0

我正在做NPM安裝在Windows 7中,我不知道爲什麼我得到這個錯誤。NPM安裝失敗在windows-7

C:\xampp\htdocs\dev4\nodejs\node_modules\jsdom\node_modules\contextify>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:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.t 
argets(64,5): error MSB8020: The build tools for Visual Studio 2010 (Platform T 
oolset = 'v100') cannot be found. To build using the v100 build tools, please i 
nstall Visual Studio 2010 build tools. Alternatively, you may upgrade to the c 
urrent Visual Studio tools by selecting the Project menu or right-click the sol 
ution, and then selecting "Upgrade Solution...". [C:\xampp\htdocs\dev4\nodejs\n 
ode_modules\jsdom\node_modules\contextify\build\contextify.vcxproj] 
gyp ERR! build error 
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` fail 
ed with exit code: 1 
gyp ERR! stack  at ChildProcess.onExit (C:\Program Files (x86)\nodejs\node_mo 
dules\npm\node_modules\node-gyp\lib\build.js:267:23) 
gyp ERR! stack  at ChildProcess.emit (events.js:98:17) 
gyp ERR! stack  at Process.ChildProcess._handle.onexit (child_process.js:810: 
12) 
gyp ERR! System Windows_NT 6.1.7601 
gyp ERR! command "node" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\nod 
e_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" 
gyp ERR! cwd C:\xampp\htdocs\dev4\nodejs\node_modules\jsdom\node_modules\context 
ify 
gyp ERR! node -v v0.10.31 
gyp ERR! node-gyp -v v1.0.1 
gyp ERR! not ok 
npm ERR! [email protected] install: `node-gyp rebuild` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] install script. 
npm ERR! This is most likely a problem with the contextify 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 contextify 
npm ERR! There is likely additional logging output above. 

npm ERR! System Windows_NT 6.1.7601 
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program File 
s (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" 
npm ERR! cwd C:\xampp\htdocs\dev4\nodejs 
npm ERR! node -v v0.10.31 
npm ERR! npm -v 1.4.23 
npm ERR! code ELIFECYCLE 
npm ERR! 
npm ERR! Additional logging details can be found in: 
npm ERR!  C:\xampp\htdocs\dev4\nodejs\npm-debug.log 
npm ERR! not ok code 0 

我試圖做單獨的模塊,但該模塊沒有安裝,因爲它內部依賴於其他所需的模塊。

我做了很多Google,但沒有得到任何解決方案。

任何建議對我都有幫助。

+0

閱讀錯誤消息,它們非常詳細! – 2014-12-03 06:53:39

回答

2

從您發佈的錯誤日誌中,node-gyp無法找到Visual Studio的副本以在構建過程中使用。

node-gyp documents用於Windows,你需要:

  • 的Python(v2.7.3推薦,不支持V3.XX)
  • 視窗XP/Vista/7:
    • 微軟的Visual Studio C++ 2010(快速版運行良好)
    • 對於64位版本的節點和本機模塊,您還需要Windows 7 64位SDK
    • 如果安裝失敗,請嘗試uni安裝任何C++ 2010 x64 &先安裝的x86可再發行組件。
    • 如果出現錯誤,該64位編譯器沒有安裝,你可能還需要編譯器更新Windows SDK 7.1
  • 的Windows 7/8: 微軟的Visual Studio C++ 2012/13的Windows桌面(快速版運行良好)

確保您安裝了Visual Studio Express或更高版本的副本,然後重試。

+0

謝謝,@Matthew,你明白了, – abdulbarik 2014-12-04 09:24:47

0

node-gyp documents for Windows,您可以選擇:

選項1:安裝所有使用微軟的Windows的構建工具使用NPM所需的工具和配置安裝--global - 生產窗戶 - 從升級的PowerShell或CMD.exe生成工具(以管理員身份運行)。