Skip to content

Please provide a darwin-unknown-arm64 prebuild #2075

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
alebx opened this issue Jul 12, 2022 · 3 comments
Closed

Please provide a darwin-unknown-arm64 prebuild #2075

alebx opened this issue Jul 12, 2022 · 3 comments

Comments

@alebx
Copy link

alebx commented Jul 12, 2022

Feature

Please provide a darwin-unknown-arm64 prebuild, since the native build needs quite a lot of dependencies.

Your Environment

  • Version of node-canvas: 2.9.3
  • Environment macOS 12.4 arm64
@schaeferto
Copy link

schaeferto commented Jul 13, 2022

Having same problems here.

I was stumbling over this issue when installing jsdom on my machine. Here some background. Maybe this helps to understand what's happening.

It would also break if you depend on canvas only - but I just wanted to make clear, that the new npm version is pulling peer dependencies and will fail a jsdom installation and different other installations depending on jsdom etc. etc. (in my case it was jest->jsdom->canvas)

Basic info:

node: v16.16.0
npm: v8.13.2
jsdom: 20.0.0
node-gyp: v9.0.0

OS: MacOS 12.4. (M1 - arm64/v7)

Minimal reproduction case

Just create a minimal npm project which depends on jsdom: "^20.0.0"

{
  "name": "test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "jsdom": "^20.0.0"
  }
}

When I try to execute npm install I get:

npm ERR! code 1
npm ERR! path /<shortened>/node_modules/canvas
npm ERR! command failed
npm ERR! command sh -c /var/folders/zm/fhwjddvj2ml6m5rbjyrxp3340000gn/T/install65772776469.sh
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp info find Python using Python version 3.9.13 found at "/opt/homebrew/opt/[email protected]/bin/python3.9"
npm ERR! gyp info spawn /opt/homebrew/opt/[email protected]/bin/python3.9
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '<shortened>/v16.16.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '<shortened>/node_modules/canvas/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '<shortened>/v16.16.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '<shortened>/Library/Caches/node-gyp/16.16.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=<shortened>/Library/Caches/node-gyp/16.16.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=<shortened>/v16.16.0/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=<shortened>Library/Caches/node-gyp/16.16.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=<shortened>/node_modules/canvas',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! Package pangocairo was not found in the pkg-config search path.
npm ERR! Perhaps you should add the directory containing `pangocairo.pc'
npm ERR! to the PKG_CONFIG_PATH environment variable
npm ERR! No package 'pangocairo' found
npm ERR! gyp: Call to 'pkg-config pangocairo --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (<shortened>/v16.16.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:261:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Darwin 21.5.0
npm ERR! gyp ERR! command "<shortened>/v16.16.0/bin/node" "<shortened>/v16.16.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd <shortened>/node_modules/canvas
npm ERR! gyp ERR! node -v v16.16.0
npm ERR! gyp ERR! node-gyp -v v9.0.0
npm ERR! gyp ERR! not ok

A temporary fix can be to npm install --omit peer if you dont want to use canvas at all.
Or you can do brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman. This should install the missing libraries on your system so you can build node-canvas from sources. (you dont need to do this explicitly - just run npm install :-) )

@ghost
Copy link

ghost commented Sep 30, 2022

Seems same kind of issue in Mac M1 docker build with Native docker install.

@chearon
Copy link
Collaborator

chearon commented Dec 7, 2024

Prebuilds are working for macOS/Arm since #2354 was merged!

npm install canvas@next to get 3.0.0-rc3. I'm going to wait a few days before releasing 3.0.

@chearon chearon closed this as completed Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants