Open Sakari369 opened 4 years ago
Seems this has something to do with:
https://github.com/nodejs/node/pull/30339: src: migrate to newer V8 ArrayBuffer APIs ?
V8 deprecates GetContents() in favour of GetBackingStore().
Don't really understand enough of the Electron build process to figure out why the build fails with the Electron v8 using electron-rebuild.
Tested with newest Electron 9 also, which should include v8 8.3, which should have this change already made in it.
Downgraded my Node from 14.x to the LTS release 12.16.3 but no success either there.
I had the same problem with version 2.14.1 of nan. After switching back to 2.14.0 everything works.
Thank you @Thosty , this indeed fixed the compilation problem! Will report the bug to the nan repository.
Will close this issue as not directly a node-canvas issue, installing nan v2.14.0 manually fixed the problem.
I installed "nan": "2.13.2" in node_modules/canvas with below command cd node_modules npm i nan@2.13.2
And, This is working
Node: 14.16.0 electron: "^12.0.1", electron-builder: "^20.19.2",
@nkhs @Sakari369 not working for me
Win10 Node v14.17.3 Electron v12.0.14 nan v2.13.2 or v2.14.0
By the way, my mac is fine.
@wxfred Yeah no idea about Windows. Seems with these problems the solution is to try install and re-install different versions.
Faced this issue again when rebuilding node-canvas for Windows 10. @wxfred installing nan@2.14.0 manually fixed this for me, as mentioned before by Thosty.
@Sakari369 Thanks a lot, I made it with
win10 node v14.17.3 electron v11.4.10 canvas v2.6.1 nan v2.14.0
But, Pattern
is not implemented in node-canvas 2.6.1 according to https://github.com/Automattic/node-canvas/pull/1623#commits-pushed-379a650
It will be another nightmare for me when the new version come out.
I have the same problem. Is there any "official" solution coming? The versions @wxfred provided don't work for me...
I have the same problem with newest versions... Is there a fix for that?
I have same problem as well. Have been troubleshooting for weeks and cannot find a workaround / solution. This is very frustrating because node-canvas is a dependency in many packages so it not only effects node-canvas but most packages that utilize.
Has anyone figured out a decent workaround? I am fine if it is super hacky for the time being. Thanks!
Hey @GitMurf , did you find any solution for this ? Or @EvanBldy ?
Seems this failure happens again with Electron 24 and newest or older version of canvas on Windows 10. on macOS this works just fine.
Fixing nan package to 2.14.0 no longer works it seems.
Might have to spend some time looking into this.
@Sakari369 good news! The solution was essentially that canvas needed to migrate to using node addon api instead of nan. Here are details: https://github.com/Automattic/node-canvas/issues/923
And lucky for you with this timing, @chearon just submitted a PR for this (months ... really years, in the making!) https://github.com/Automattic/node-canvas/pull/2235
@Sakari369 good news! The solution was essentially that canvas needed to migrate to using node addon api instead of nan. Here are details: #923
And lucky for you with this timing, @chearon just submitted a PR for this (months ... really years, in the making!) #2235
Good news! Thanks for sharing 🙂 Did not completely understand if this would fix the issue, but apparently yes ?
I was mentally prepared to spend couple of days to find a quick fix for this somehow, but happy that this issue might be fixed for good with the migration to n-api.
Have you tested the branch with the pr ?
Have you tested the branch with the pr ?
I have not tested it yet. Priorities have shifted for my application so it isn't as urgent anymore so I will test when it gets officially released.
I was mentally prepared to spend couple of days to find a quick fix for this somehow...
I thought that as well and after weeks of attempts I realized there really wasn't a "quick fix" so good thing you avoided that rabbit hole ;-)
Have you tested the branch with the pr ?
I have not tested it yet. Priorities have shifted for my application so it isn't as urgent anymore so I will test when it gets officially released.
I was mentally prepared to spend couple of days to find a quick fix for this somehow...
I thought that as well and after weeks of attempts I realized there really wasn't a "quick fix" so good thing you avoided that rabbit hole ;-)
Have you tested the branch with the pr ?
I have not tested it yet. Priorities have shifted for my application so it isn't as urgent anymore so I will test when it gets officially released.
I was mentally prepared to spend couple of days to find a quick fix for this somehow...
I thought that as well and after weeks of attempts I realized there really wasn't a "quick fix" so good thing you avoided that rabbit hole ;-)
Thanks for the info! Will give it a spin probably soon, hoping to give some feedback also from that if it's working on both macOS and Windows with electron.
Yeah.. okay good to know that :)
@GitMurf I am developing an Electron app that relies on canvas
like many others. It looks like there is an open PR for N-API. I installed it and my build now runs successfully.
@GitMurf I am developing an Electron app that relies on
canvas
like many others. It looks like there is an open PR for N-API. I installed it and my build now runs successfully.
Thanks for confirming it works even "as is" before it gets merged. Great news! I'll probably get around to testing it next week.
i have the same problem but in my case i am having this problem because of a library i am using
The issue still persists. Tried doing
npm i Automattic/node-canvas#c32c39bf5b65cb3409f37602d2e59818d0d5e892
but still same issue.
I am having the same problem while including the latest version of Automattic/node-canvas. Has there been any new updates or ways to resolve this issue in the past several months?
I am having the same problem while including the latest version of Automattic/node-canvas. Has there been any new updates or ways to resolve this issue in the past several months?
Unfortunately I don't think so. @chearon do you know what current status is? Thanks!
Issue or Feature
Build fails in Windows 10 x64 using electron-rebuild with Electron. Build works perfectly fine with just npm install canvas or building manually with node-gyp configure && node-gyp build.
Seems to be something incompatible with the canvas and the electron environment ? Building the canvas works perfectly fine with same setup in macOS Mojave.
The specific error reported by the compiler:
Steps to Reproduce
Install all the windows build prerequisities (GTK, libjpeg) in the locations provided by the install instructions.
Running
Fails with the following message errors:
This line being the culprit:
Canvas.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: class std::sharedptr cdecl v8::ArrayBuffer::GetBackingStore(void)" (imp ?GetBackingStore@ArrayBuffer@v8@@QEAA?AV?$shared_ptr@VBackingStore@v8@@@std@@XZ)
Your Environment
npm list canvas
oryarn list canvas
):Electron 8.2.0, electron-rebuild 1.11.0 on Windows 10 x64. MSVC2019 Community edition
Any help is appreciated! Anybody got the canvas module rebuilt in Windows using electron-rebuild ? Thank you.