-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
npm intall not working #2371
Comments
You have error in log:
Try install setuptools
|
yes thank you its working, but now I have this error: Error: dlopen(/Users/artichaut/Documents/GitHub/2/SpotiPixel/node_modules/canvas/build/Release/canvas.node, 0x0001): symbol not found in flat namespace '_cairo_fill' I already tried brew install cairo |
Okay, maybe you need to install all of this?
|
If you are on a recent version of Mac OS the default python version is 3.x.x. For unknown reasons canvas could not be compiled if python version was 3.x.x. Run the following commands:-
Note: I used this solution on MacBook pro M1 macOS Sonoma 14.4.1 |
Just in case anyone else has this problem on a recent Mac OS: There has been an ( First, check if
This is an error:
If you get an error reinstall |
In my case, it compiled* on python 3.12.2 * after many painful hours |
Yes, I forgot to mention it: Python 3.1X is expected to work |
This is my current process for a failed install on Apple Silicon: brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman python@3.12 rm -rf node_modules npm install If you don't have the |
Thanks @TrevorSayre saved my day, your suggestion worked! |
Added `python@3.12` and `python-setuptools` to instructions as per comments in Automattic#2371 and Automattic#2387
I updated the readme to list python-setuputils as a prereq on macOS. Thanks for the collective troubleshooting! |
Issue or Feature
I can't install canvas on my Mac, I have this error:
artichaut@Pierres-MacBook-Air-3820 SpotiPixel % sudo npm i canvas
npm ERR! code 1
npm ERR! path /Users/artichaut/Documents/GitHub/SpotiPixel/node_modules/canvas
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build --update-binary
npm ERR! Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/Users/artichaut/Documents/GitHub/SpotiPixel/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/artichaut/Documents/GitHub/SpotiPixel/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@1.0.11
npm ERR! node-pre-gyp info using node@18.18.0 | darwin | arm64
npm ERR! node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v108-darwin-unknown-arm64.tar.gz
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v108-darwin-unknown-arm64.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for canvas@2.11.2 and node@18.18.0 (node-v108 ABI, unknown) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v108-darwin-unknown-arm64.tar.gz
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.4.0
npm ERR! gyp info using node@18.18.0 | darwin | arm64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.4.0
npm ERR! gyp info using node@18.18.0 | darwin | arm64
npm ERR! gyp info find Python using Python version 3.12.2 found at "/usr/local/opt/python@3.12/bin/python3.12"
npm ERR! gyp info spawn /usr/local/opt/python@3.12/bin/python3.12
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/usr/local/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 '/Users/artichaut/Documents/GitHub/SpotiPixel/node_modules/canvas/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/artichaut/Library/Caches/node-gyp/18.18.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=/Users/artichaut/Library/Caches/node-gyp/18.18.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/artichaut/Library/Caches/node-gyp/18.18.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/artichaut/Documents/GitHub/SpotiPixel/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! Traceback (most recent call last):
npm ERR! File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 42, in
npm ERR! import gyp # noqa: E402
npm ERR! ^^^^^^^^^^
npm ERR! File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/init.py", line 9, in
npm ERR! import gyp.input
npm ERR! File "/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 19, in
npm ERR! from distutils.version import StrictVersion
npm ERR! ModuleNotFoundError: No module named 'distutils'
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error:
gyp
failed with exit code: 1npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:325:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:517:28)
npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:292:12)
npm ERR! gyp ERR! System Darwin 23.2.0
npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--update-binary" "--module=/Users/artichaut/Documents/GitHub/SpotiPixel/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/Users/artichaut/Documents/GitHub/SpotiPixel/node_modules/canvas/build/Release" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v108"
npm ERR! gyp ERR! cwd /Users/artichaut/Documents/GitHub/SpotiPixel/node_modules/canvas
npm ERR! gyp ERR! node -v v18.18.0
npm ERR! gyp ERR! node-gyp -v v9.4.0
npm ERR! gyp ERR! not ok
npm ERR! node-pre-gyp ERR! build error
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/Users/artichaut/Documents/GitHub/SpotiPixel/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/artichaut/Documents/GitHub/SpotiPixel/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
npm ERR! node-pre-gyp ERR! stack at ChildProcess. (/Users/artichaut/Documents/GitHub/SpotiPixel/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.emit (node:events:517:28)
npm ERR! node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1098:16)
npm ERR! node-pre-gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:303:5)
npm ERR! node-pre-gyp ERR! System Darwin 23.2.0
npm ERR! node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/artichaut/Documents/GitHub/SpotiPixel/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--update-binary"
npm ERR! node-pre-gyp ERR! cwd /Users/artichaut/Documents/GitHub/SpotiPixel/node_modules/canvas
npm ERR! node-pre-gyp ERR! node -v v18.18.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.11
npm ERR! node-pre-gyp ERR! not ok
npm ERR! A complete log of this run can be found in: /Users/artichaut/.npm/_logs/2024-03-31T19_47_54_510Z-debug-0.log
(already tried this https://github.com/Automattic/node-canvas/wiki/Installation%3A-Mac-OS-X)
and this https://stackoverflow.com/questions/71352368/is-it-possible-to-install-canvas-with-m1-chip )
Steps to Reproduce
npm I canvas
Your Environment
npm list canvas
oryarn list canvas
): nonenode v18.18.0 on Mac OS Sonoma 14.2.1 m2 MacBook Air
The text was updated successfully, but these errors were encountered: