I am trying to install Tilestrata on a DigitalOcean server. I already have it up and running on an AWS instance. But although I think I'm doing the same thing I did to install it on AWS, so far I have been stymied in getting it running on DO by the following error:

safeuser@Server:~/tileserver$ node server.js

    var callback = function(err) { if (err) throw err; };
Error: Unable to initialize "basemap" layer: "expected < at line 1"
    at /home/safeuser/node_modules/tilestrata/lib/TileServer.js:106:19
    at /home/safeuser/node_modules/tilestrata/node_modules/async/lib/async.js:52:16
    at done (/home/safeuser/node_modules/tilestrata/node_modules/async/lib/async.js:243:17)
    at /home/safeuser/node_modules/tilestrata/node_modules/async/lib/async.js:44:16
    at Object._onImmediate (/home/safeuser/node_modules/tilestrata/lib/TileRequestHandler.js:125:4)
    at processImmediate [as _immediateCallback] (timers.js:330:15)

It seems like it's having issues with the Mapnik XML file, but I've checked the file and the route to the file, and it should be fine. It's the exact same project.xml file I'm using successfully on AWS. Here is the contents of my server.js file:

var tilestrata = require('tilestrata');
var disk = require('tilestrata-disk');
var mapnik = require('tilestrata-mapnik');
var dependency = require('tilestrata-dependency');
var strata = tilestrata();

// define layers
        .use(disk.cache({dir: './tiles/basemap/'}))
            xml: './project/project.xml',
            tileSize: 256,
            scale: 1

// start accepting requests

I must be missing something here, and I've been investigating for days. Any insights would be most welcome.

1 Answer 1


What you're encountering is an unfortunate side-effect of a breaking change in 0.4 of tilestrata-mapnik (changelog). When specifying the path to an XML file, use pathname instead of xml. This parameter change was in order to accommodate people specifying XML that's in memory, not on disk.

Sorry about that!

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.