'GetContents' in 'v8::ArrayBuffer'
Asked Answered
H

2

21

I'm using Mac M1 and I've just upgraded to Node 14.17.6LTS.

I tried to rebuild better_sqlite3 (7.4.3) using with electron builder (22.11.7) and I'm getting the following errors:

no member named 'GetContents' in 'v8::ArrayBuffer'

Any ideas how to solve this? Thanks in advance!

gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
In file included from ../fsevents.cc:6:
In file included from ../../nan/nan.h:2884:
../../nan/nan_typedarray_contents.h:34:43: error: no member named 'GetContents' in 'v8::ArrayBuffer'
      data   = static_cast<char*>(buffer->GetContents().Data()) + byte_offset;
Harrus answered 22/9, 2021 at 20:26 Comment(0)
D
14

I'm using Mac M1 and I've just upgraded to Node 14.17.6LTS.

An interesting choice, given that Node 16 officially introduced M1 support.

no member named 'GetContents' in 'v8::ArrayBuffer'

See this doc. In short, GetContents was replaced by GetBackingStore in late 2019. Being a compatibility layer, nan adapted to this in early 2020.

So you'll probably have to ensure that the versions of all involved packages (Node, nan, electron, ...) match each other (in the sense of having been released around the same time and targeting each other).

Dipody answered 23/9, 2021 at 1:15 Comment(4)
This is a good hint, thanks. It's already 2021 now, I'm using node 17.2.0, npm 8.3.0, node-gyp 8.4.1 (installed as a workaround for another problem), nan 2.15.0, electron 16.0.4 and it still gives me the error: no member named 'GetContents' in 'v8::ArrayBuffer'Unseat
@JanosVinceller: nan 2.15 does contain the fix I linked in my answer. If you're saying that that fix isn't working, more information is needed. Maybe file a bug against nan?Dipody
Your hint to use nan 2.15 was the solution! My problem was, I didn't define nan as a dependency, so some lib I depended on probably pulled in some older version. Now that I defined explicitly nan 2.15.0 as a dependency, it is finally working! Thanks!Unseat
Two more comments on this. I was using an older npm and I got the error again. Installed the latest npm again brought me another error (#69693342) which I could solve by one of the answers: export NODE_OPTIONS=--openssl-legacy-provider.Unseat
S
0

Following @Janos Vinceller's comment I've solve the issue in Node v17.6.0 setting NODE_OPTIONS environment variable:

export NODE_OPTIONS=--openssl-legacy-provider

Stripe answered 11/3, 2022 at 16:42 Comment(2)
node: --openssl-legacy-provider is not allowed in NODE_OPTIONSHildy
@cheesus it worked for Node v17.6.0. I tried in previous versions and it raise the error you reported. I edited my answer accordingly. Thanks for your feedback!Stripe

© 2022 - 2024 — McMap. All rights reserved.