-
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
⭐ How to Troubleshoot Installation #1511
Comments
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as duplicate.
This comment was marked as duplicate.
This comment has been minimized.
This comment has been minimized.
I did. I was using the module inside an electron app. Electron seems to run with its own version of node. In my case I had to find out what version of node electron was running, and rebuild the module to fit that version. |
This comment was marked as outdated.
This comment was marked as outdated.
And on the sharp documentation:
So.. I'm wondering what the expected way forward is here? I've been using I've spent the whole day trying to get my project to run and I'm facing the same error every time, wondering if I need to now make a choice between these dependencies and try and move on. |
The majority of issues opened in node-canvas are for installation help. This post is an experiment to see if we can help users help themselves to troubleshoot installations.
Installation fails with a 404 in the log
If you have an ARM CPU, including an Apple M1 or M2
Prebuilds aren't available for ARM. Please see the wiki for guides on building from source. See also node-gfx/node-canvas-prebuilt#69.
If you're on Alpine Linux or another distro using musl-libc
The log may look like
Prebuilds are only available for glibc, not musl-libc. See node-gfx/node-canvas-prebuilt#77, which includes information on building from source.
If you're using Electron
The log may look like
There are no prebuilds available for Electron. Please see the wiki for guides on building from source. See also node-gfx/node-canvas-prebuilt#84 or #1467.
If a new version of Node.js was recently released
The log may look like
We manually publish prebuilt versions of node-canvas, and it can take some time for us to catch up.
You can see the list of available prebuilds here (expand the "Assets" section under the version you're trying to install): https://github.com/node-gfx/node-canvas-prebuilt/releases.
If you're using 32-bit Node.js
The log will include a 404 and
ia32
. Node-canvas does not readily compile on 32-bit platforms because the necessary dependencies are hard to obtain. Use 64-bit Node.js instead, especially because 32-bit Node.js is only experimentally supported by the Node foundation.I get a permissions error (
EACCES
)Possibly your
node_modules
or an npm or yarn cache or temp directory is owned by a different user. Review the error log to see what folder you don't have permission to access. See #1429 for an example, or any of these issues.If you were trying to install with
sudo
, try without. (See issues.)I get a
NODE_MODULE_VERSION
errorThe log may look like
This could mean you upgraded Node.js without re-installing canvas. Try running
yarn
ornpm install
again.This can also happen if you're using Electron. The version of Node wrapped by Electron must match the version of Node that you used to build/install canvas.
Installation fails with lots of compiler errors, including
...was declared deprecated
and/orno viable conversion
and/or'Handle' is not a member of 'v8'
You're probably trying to install an old version of node-canvas. Version 2.x is required for Node.js v6.x and later. Version 2.5.x or later is required for Node.js v12.x and later. Check if your package.json or lock file specifies an old version.
I get a
the specified procedure could not be found
errorIf you have Sharp.js also installed, there's an incompatibility between their build of Cairo and our build of Cairo. See #930.
I get the error
canvas.node is not a valid Win32 application.
This usually means you have 32-bit Node.js and 64-bit node-canvas, or vice versa. They must be the same (and you should prefer 64-bit over 32-bit). You can check this is the issue using the instructions in #1533 (comment). It can also mean you're trying to use the Linux or Mac build from Windows.
I get a GLIBC version error
If you installed Node.js with snaps
This can happen if you installed Node.js with snaps instead of apt/dpkg, and if the snap core has an older version of glibc. (Background: #1959.)
If you're on CentOS 7 or EL 7
CentOS 7 and EL 7 use GLIBC 2.17, but v2.8.0+ of node-canvas were prebuilt with v2.24 from Debian Stretch. That is the minimum version of glibc required to use node-canvas 2.8.0+. For now, a workaround is to use node-canvas 2.7.0, or build from source.
Module did not self-register
Node-canvas isn't compatible with worker threads yet, see #1394. Canvas needs to be ported from NAN to N-API (#923).
To keep this issue concise and on-topic, (1) comments asking for help will be deleted, please open a separate issue instead, (2) comments with suggestions for improving the troubleshooting are welcome and will be hidden after incorporating into this top post.
The text was updated successfully, but these errors were encountered: