Skip to content

Cannot install canvas on apple silicon #2365

@EdwardMoyse

Description

@EdwardMoyse

Issue or Feature

I have done: brew install pkg-config cairo pango libpng jpeg giflib librsvg

And I have tried many, many other ways to get around this (some of which are listed here)

But I still cannot install canvas on Apple silicon. Failure is:

In file included from /Users/emoyse/Library/Caches/node-gyp/21.7.1/include/node/v8-array-buffer.h:12:
/Users/emoyse/Library/Caches/node-gyp/21.7.1/include/node/v8-local-handle.h:253:5: error: static assertion failed due to requirement 'std::is_base_of<v8::Value, v8::Data>::value': type check
    static_assert(std::is_base_of<T, S>::value, "type check");
    ^             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../nan/nan_callbacks_12_inl.h:175:20: note: in instantiation of function template specialization 'v8::Local<v8::Value>::Local<v8::Data>' requested here
      cbinfo(info, obj->GetInternalField(kDataIndex));
                   ^

N.B. we don't actually have a direct dependency on canvas from phoenix, but get it from a package we use jsroot.

emoyse@macminim1umass phoenix % yarn why canvas
└─ jsroot@npm:7.6.0
   └─ canvas@npm:2.11.2 (via npm:^2.11.2)

Steps to Reproduce

git clone https://github.com/HSF/phoenix.git 
cd phoenix 
yarn install

This will fail with:

➤ YN0009: │ canvas@npm:2.11.2 couldn't be built successfully (exit code 1, logs can be found here: /private/var/folders/j6/cv3xx2910nx_pg7v2t8czqzc0000gn/T/xfs-bf1ea463/build.log)

(build.log is attached)

What is weird is checking out node-canvas and doing yarn install there seems to work... the only obvious difference I see in the log files is node-gyp version:

< gyp info using [email protected]
---
> gyp info using [email protected]

Your Environment

  • yarn --version : 3.3.1
  • Version of node-canvas: v2.11.2
  • Environment: node 21.7.1 on macOS 14.3.1, Apple M1

build.log

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions