'GetContents' 在 'v8::ArrayBuffer'

'GetContents' in 'v8::ArrayBuffer'

我正在使用 Mac M1,我刚刚升级到 Node 14.17.6LTS。

我尝试使用 electron builder (22.11.7) 重建 better_sqlite3 (7.4.3),但出现以下错误:

在 'v8::ArrayBuffer'

中没有名为 'GetContents' 的成员

有什么解决办法吗?提前致谢!

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;

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

一个有趣的选择,因为 Node 16 正式引入了 M1 支持。

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

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

因此,您可能必须确保所有相关包(Node、nan、electron 等)的版本相互匹配(在大约同时发布并相互针对的意义上) ).

根据@Janos Vinceller 的评论,我已经解决了 Node v17.6.0 设置 NODE_OPTIONS 环境变量中的问题:

export NODE_OPTIONS=--openssl-legacy-provider