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

社会主义新天地 提交于 2019-11-30 04:50:06

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
Antfish

I'm just going through an Angular JS tutorial and had this issue, but their docs suggest it isn't a problem:

"We often see an npm WARN message after a series of gyp ERR! messages. Ignore them. A package may try to re-compile itself using node-gyp. If the re-compile fails, the package recovers (typically with a pre-built version) and everything works."

https://angular.io/guide/quickstart

For me the problem came after installing a new version of node. npm install would show the error above. Then I got the error above but not for the package PreRender.Io but for gulp-sass, though I believe the problem has the same root. To solve it, I installed the previous version of node I'd been using (6.9.5) and then I used nvm to manage node versions as described here: https://www.sitepoint.com/quick-tip-multiple-versions-node-nvm/

Switching to the previous version of node using nvm meant I could do npm install without having to install a large SDK I wasn't going to end up using.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!