After successfully working with node-mapnik (and the gorgeous vector tiles) on Linux I'm trying to set them up on Windows too, but have come to a dead end.

What I've done so far:

  • Installed mapnik 2.2.0 SDK and added the bin and lib directories to the PATH.
  • Using npm install mapnik shows an error about a missing cairo header file.
  • Cloning the repository and adding the cairo directory to binding.gyp solved the header issue.
  • Next error is about the target architecture (32 vs. 64bit), because the generated solution is 64bit only. I solved this by adjusting the gyp config parameters to get a Win32 target.
  • Next errors are about missing boost libraries. I followed the tutorial on how to build mapnik dependencies on Windows to the letter and added the boost-49-vc100\lib directory to the AdditionalLibraryDirectories. Which results in this error:

    Creating library C:\dev2\node-mapnik\node-mapnik\build\Release\_mapnik.lib and object C:\dev2\node-mapnik\node-mapnik\build\Release\_mapnik.exp LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library [C:\dev2\node-mapnik\node-m apnik\build\_mapnik.vcxproj] mapnik_image_view.obj : error LNK2001: unresolved external symbol "void __cdecl boost::throw_exception(class std::exception const & )" (?throw_exception@boost@@YAXABVexception@std@@@Z) [C:\dev2\node-mapnik\ node-mapnik\build\_mapnik.vcxproj] C:\dev2\node-mapnik\node-mapnik\build\Release\_mapnik.node : fatal error LNK1120: 1 unresolved externals [C:\dev2\node-mapnik\node- mapnik\ build\_mapnik.vcxproj]

Any suggestions on how to get node-mapnik (with vector tile support) running on Windows?

3 Answers 3


I've been following mapnik and tilesplash, and it is always a pain to get it installed on Windows. This is so far (as of Feb.16 2022) the most I could get:

How I got here:

  1. Install NVM for Windows: (if you have other node.js packages that's not compatible with Node 8.X.X; If you don't, install Node.js 8.17.0 or whatever 8.X.X.)
  2. Remove C:\Users\<your username>\.windows-build-tools if existed. Or not, if you don't want to mess up with your previous windows-build-tools. You probably have no such directory because you didn't try to install OS-dependent node modules.
  3. Start command line as admin.
  4. Do nvm install 8.17.0, then nvm use 8.17.0. (if you use nvm.)
  5. Do npm install --global --vs2017 --production windows-build-tools. Wait until it says Python is installed, then make sure Visual Studio Installer is downloaded to C:\Users\<your username>\.windows-build-tools as vs_BuildTools.exe. The installation will appear stucked but don't worry. Ctrl-C to terminate this npm install.
  6. Double click on C:\Users\<your username>\.windows-build-tools\vs_BuildTools.exe to manually install the required tools in VisualStudio 2017. Only MSBuild Tools, Visual C++ build tools and Visual Studio Extensibility SDK are required. It is sufficient to keep the default selections under these categories.
  7. Do npm config set msvs_version 2017.
  8. Do set VCTargetsPath=C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VC\VCTargets. I'm pretty sure this path exists if you properly installed VisualStudio 2017. Check if the path is properly set by echo %VCTargetsPath%.
  9. Last but not least, npm install [email protected](and if you need to install tilesplash, do npm install tilesplash after mapnik is installed.)

Good luck! Currently I'm also watching the development of the mapnik build using vcpkg, but vcpkg itself is already something for me to study. This vcpkg build looks less OS-dependent and promising for higher Node.js versions.

So far I'm happy with my settings, but having to switch among Node.js versions is still a bit inconvenient so I'll keep watching.


I think the problem is a linking issue: you likely need /MD while /MT is being set. See Step 3 in my comment at https://github.com/mapnik/node-mapnik/issues/202#issuecomment-31876610.


Solution (tested on W7-64 with node.js-32. 64bit currently not supported):

  • use node-mapnik from Github
  • get cairo sources: http://www.cairographics.org/
  • copy cairo-svg-surface.c, cairo-svg.h and cairo-svg-surface-private.h to C:\mapnik-v2.2.0\include
  • make proj4 epsg files available: SET PROJ_LIB=C:\mapnik-v2.2.0\share\proj
  • now npm install should finish successfully, provided that all other requirements are met: mapnik SDK, Python, protobuf, etc, ...
  • register all needed input plugins in your script (not auto registered in current Github source) e.g. shapefile input: mapnik.register_datasource(path.join(mapnik.settings.paths.input_plugins,'shape.input'));

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.