javascript - Carto 引发 TypeError:无法读取未定义的属性“hasOwnProperty”
问题描述
我一直在关注本教程: https ://switch2osm.org/serving-tiles/manually-building-a-tile-server-20-04-lts/
并被困在跑步中
carto project.mml > mapnik.xml
我的目标是设置 OSM 服务器 - 所以 carto 的预期行为是将 project.mml 编译为“准备渲染”mapnik.xml。
实际行为如下: Carto 引发错误:
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)
我知道这个 Github 问题: https ://github.com/gravitystorm/openstreetmap-carto/issues/3409 和这个 SO 问题: TypeError: Cannot read property 'hasOwnProperty' of undefined node-carto but didn't find them有用.
我正在使用 Ubuntu 20.04 Focal Fossa,mapnik 版本是 0.1,由于上述错误,我无法检查 carto 版本。
诀窍是,由于公司政策,我正在使用的机器没有(也不会)连接到 Internet - 我通过 SSH 登录。因此,我使用 insted sudo apt install nodejs-carto
of安装了 carto npm install -g carto
- 该公司在 Intranet 内的 Ubuntu 存储库上有镜像。
解决方案
显然,问题是 carto 版本太低 - 更新到carto@1.2.0
问题后消失了。
推荐阅读
- visual-studio - 如何在 Visual Studio 中使用路径映射将调试器附加到 Azure 应用服务?
- sql - 如何建模两个非常大的表之间的多对多关系?
- joomla - Joomla - 页面构建器 - 带有发布工作流程
- java - JUnit中Service类的NoSuchBeanDefinitionException
- javascript - 在数组映射 reactJS 中使用变量
- vue.js - 我无法在我的 vue / nuxt 项目中变得更漂亮和更漂亮
- python - 在 pandas 数据框的每一列上应用多个函数
- javascript - 查询。隐藏其他元素,除了这个
- nestjs - 如何从 Nest fastify 服务器中创建的中间件发送响应?
- asp.net-core-webapi - K6 和 .NEТ Core 中的 NTLM 请求