node-mapnik
node-mapnik copied to clipboard
Print warning on multiple installs of node-mapnik in node_modules tree
trafficstars
If more than one node-mapnik ends up in the npm/node-modules dependency tree then:
- at best: font or datasource registration may unpredictably fail because the global caches only behave correctly if truly once instance is loaded in the process.
- at worst these issues only manifest in production and go unnoticed in local development
- also odd behavior can also occur when the duplicate node-mapnik versions are different and have different ABI - leading to either symbol errors at startup or crashes.
For these reasons it is critical that only one node-mapnik version is installed in the node_modules tree. This means that npm's behavior of non deduping duplicate modules (under various circumstances) is fundamentally incompatible with node-mapnik. Therefore we need to help users and developers ensure that only one node-mapnik is installed. This would help flag when:
- two dependencies are used that each depend on node-mapnik and unintentionally install different versions
- or the declaration of a top level node-mapnik does not work to dedupe the deps
re-wrote the above ticket with more detail - also refs https://github.com/mapbox/versioning-node-cpp (which could take language from this ticket)