2015-10-20 119 views
25

我一直試圖在我的本地機器上安裝PreRender.Io進行測試。我已經安裝了Python 2.7.10。當我鍵入:無法使用npm安裝prerender - 「無法找到:CL.exe」

npm install prerender

它給出了一個錯誤:

C:\PreRender\node_modules\prerender\node_modules\phantom\node_modules\dnode\node 
_modules\weak>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) 
Building the projects in this solution one at a time. To enable parallel build, 
please add the "/m" switch. 
TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot find the 
file specified. [C:\PreRender\node_modules\prerender\node_modules\phantom\node 
_modules\dnode\node_modules\weak\build\weakref.vcxproj] 


gyp ERR! build error 
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` fail 
ed 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 

我無法找到cl.exe時,並在谷歌快速搜索似乎缺少一些的Visual C++編譯器。不過,我嘗試安裝說VC++ 2008 redistributable x86,但仍然是同樣的問題。

任何想法可能是錯誤的?操作系統是Windows 7 64位。

+0

不知道這是同一個問題或不:http://stackoverflow.com/questions/32424622/installing-ws-with-npm-causes-error-with-node-gyp –

+0

不真的,但是我終於設法解決了這個問題。我會發佈一個有關它的答案,以防萬一有人在同一個問題上絆倒 –

回答

52

我設法解決了這個問題,雖然這很奇怪。老實說,我不確定哪個人完全解決了它,因爲我已經完成了一些東西。我在我的機器上安裝了Visual Studio 2015。下面是我做了什麼內容摘要:

  • 安裝的Visual C++編譯器,從2015年VS安裝。默認情況下,它未被選中。我認爲這是解決問題的方法。

  • 加入其中CL.EXE(C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin)stdlib.h中(C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include)位於該PATH環境變量的路徑。

  • 執行npm install prerender從在Visual Studio 2015年Developer Command Prompt,在管理員模式運行
+45

只需安裝** Visual C++編譯器**就足夠了。順便說一句,你可以從VS 2015中輕鬆完成:File - > New Project - > Visual C++ - >安裝Visual C++組件(或類似的東西)。 – whyleee

+2

Visual Studio 2015社區版中的「安裝Visual C++組件」也適用於我。 –

+0

謝謝@whylee你救了我:-)爲了避免以後安裝,用戶可以在安裝過程中選擇「Programing Languages-> Visual C++」。它是在第一個屏幕上,有很多複選框只有有時它不檢查 – szydan

0

我只是經歷一個角JS教程,並有這個問題,但他們的文檔表明,它是不是一個問題:

「我們經常在一系列gyp ERR!消息後看到npm WARN消息忽略它們一個包可能會嘗試使用node-gyp重新編譯自己如果重新編譯失敗,包裹恢復(典型地與預先修造的vers離子),一切正常。「

https://angular.io/guide/quickstart

+2

。 – Jakob