Running A Prerender.io Instance Locally On Your Machine

14 August 2015

Prerender.io is (as the name suggests) a prerendering service to allow Javascript-heavy websites and SPAs to be crawled by search engines. Recently, I've had some weird rendering issues with the pages it was caching so I wanted to do a bit of debugging. It turns out you can actually run the Prerender server locally on node.js as it's all open sourced! All it takes is a few steps, as outlined here:

https://prerender.io/documentation/test-it

However, there's a few gotchas...

1) You need to install Python on your machine (in addition to Node.js) - as of writing this is version 2.7.10.

2) Your npm install may not install everything completely in one go. If you've tried running node server.js and get complaints about the weak module, it's worth manually installing it by running:

npm install weak

2.1) If you don't have Visual Studio 2010 installed, you might get the following error:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.Cpp.Platform.targets(64,5): error MSB8020: The build tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, please install Visual Studio 2010 build tools.  Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Upgrade Solution...". [C:\prerender\prerender\node_modules\weak\build\weakref.vcxproj]

You can get around this by specifying your installed version of Visual Studio:

npm install weak --msvs_version=2013

Obviously, if you have 2012 installed then replace 2013 with 2012.

That should be enough to get Prerender running without any issues locally!

Tags: Prerender.io, Python, node.js

Add a Comment

2 Comments

  • Sdarna said Reply

    Henry, Nice write up. I found very helpfull. Seems you have good experience in Azure and Prerender.I am looking for some help of Prerender server on azure.

    Using prerender server (http://service.prerender.io) I am able to crawl my angularJS,MVC website from azure. Wanted to setup my own prerender server in Azure but I am not success on that. Do you know how to setup own prerender server on Azure. Your inputs will be really helpful.

    Regards,
    Sdarana