javascriptopenstreetmapubuntu-20.04mapnik

Carto raises TypeError: Cannot read property 'hasOwnProperty' of undefined


I have been following this tutorial: https://switch2osm.org/serving-tiles/manually-building-a-tile-server-20-04-lts/

and got stuck on running

carto project.mml > mapnik.xml

My goal is to set OSM server - so expected behaviour of carto is compiling project.mml into "ready-to-render" mapnik.xml.

Actual behaviour is like the following: Carto raises error:

ubuadmin@klab-osm:~/src/openstreetmap-carto$ carto -v
/usr/lib/nodejs/carto/lib/carto/tree/reference.js:19
    if (mapnik_reference.version.hasOwnProperty(version)) {
                                 ^

TypeError: Cannot read property 'hasOwnProperty' of undefined
    at Object.ref.setVersion (/usr/lib/nodejs/carto/lib/carto/tree/reference.js:19:34)
    at /usr/lib/nodejs/carto/lib/carto/tree/reference.js:209:5
    at Object.<anonymous> (/usr/lib/nodejs/carto/lib/carto/tree/reference.js:213:3)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)

I am aware of this Github Issue: https://github.com/gravitystorm/openstreetmap-carto/issues/3409 and this SO question: TypeError: Cannot read property 'hasOwnProperty' of undefined node-carto but haven't found them helpful.

I am working on Ubuntu 20.04 Focal Fossa, mapnik version is 0.1, I am unable to check carto version due to error mentioned above.

Trick is, because of company policy the machine I am working on is not (and won't be) connected to the Internet - I log in via SSH. Because of that I installed carto using sudo apt install nodejs-carto insted of npm install -g carto - the company has mirror on Ubuntu repository inside intranet.


Solution

  • Aparently, the problem was carto version being too low - after updating to carto@1.2.0 the issue disappeared.