From 753204cbe36e875f1aee61c0ec0397c33935e278 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Fri, 17 May 2024 14:11:05 -0700 Subject: [PATCH] Fix node-canvas source compile for node >= v21 (#4122) The maplibre-gl-js install currently fails on arm64 macs when running Node >= 21. The error is: ``` ../../nan/nan.h:2546:8: error: no matching member function for call to 'SetAccessor' tpl->SetAccessor( ``` The context is that `maplibre-gl-js` depends on `node-canvas@2.x` which has a dependency on the `nan` package and `nan` 2.17 had a bug that surfaced with node v21: https://github.com/nodejs/nan/pull/966. Additionally `node-canvas` does not currently provide pre-compiled binaries for Arm64, so a source compile is needed. So, the solution here is to upgrade the `nan` version to the latest release which fixes support with recent node. --- package-lock.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 690ee9c873..ea7f3c3da0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3942,7 +3942,7 @@ "hasInstallScript": true, "dependencies": { "@mapbox/node-pre-gyp": "^1.0.0", - "nan": "^2.17.0", + "nan": "^2.19.0", "simple-get": "^3.0.3" }, "engines": { @@ -9446,7 +9446,7 @@ "license": "MIT" }, "node_modules/nan": { - "version": "2.17.0", + "version": "2.19.0", "dev": true, "license": "MIT" },