could not install prerender using npm - "Failed to locate: CL.exe"

Karl Cassar picture Karl Cassar · Oct 20, 2015 · Viewed 22.4k times · Source

I've been trying to install PreRender.Io on my local machine to test. I've installed Python 2.7.10. When I type:

npm install prerender

It gives an error:

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

I couldn't locate CL.exe, and a quick search on Google seems to be some missing Visual C++ compiler. However, I tried installing say VC++ 2008 redistributable x86, but still same problem.

Any idea what could be wrong? OS is Windows 7 64-bit.

Answer

Karl Cassar picture Karl Cassar · Oct 21, 2015

I've managed to solve the problem, although it was quite strange. Honestly, I'm not sure which one solved it completely as I've done quite some stuff. I had installed Visual Studio 2015 on my machine. Below is a summary of what I've done:

  • Installed Visual C++ Compiler, from the VS 2015 installation. By default it was unticked. I think this is what fixed the issue.

  • Added the path where CL.exe (C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin) and stdlib.h (C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include) are located to the PATH environment variable.

  • Executed the npm install prerender from the Developer Command Prompt in of Visual Studio 2015, running in Administrator mode