gpt4 book ai didi

node.js - 没有名为 ForceSet 的成员

转载 作者:搜寻专家 更新时间:2023-10-31 23:50:32 25 4
gpt4 key购买 nike

我在玩 NodeJS 和 Electron。使用 Node 10.9.0 和名为 electron-react-boilerplate 的样板。

我安装的所有 NodeJS 依赖项都正常工作,但我需要安装一个 native 模块。样板文档说要在 /app 目录中安装 native 模块,所以我做了,但它让我:

../src/binding.cc:619:11: error: no member named 'ForceSet' in 'v8::Object'
target->ForceSet(Nan::New<v8::String>("endianness").ToLocalChecked(), Nan::New<v8::String>(CheckEndianness()).ToLocalChecked(), static_cast<PropertyAttribute>(ReadOnly|DontDelete));
~~~~~~ ^
../src/binding.cc:620:11: error: no member named 'ForceSet' in 'v8::Object'
target->ForceSet(Nan::New<v8::String>("NULL").ToLocalChecked(), WrapNullPointer(), static_cast<PropertyAttribute>(ReadOnly|DontDelete));
~~~~~~

我已将我的 Node 版本切换到 8.11.3 并删除了所有已安装的 node_modulespackage-lock.json 文件,并且首先安装 native 模块 - 安装完成。

然后我切换到在根目录中安装我的模块,我得到:

Error: /usr/local/bin/node exited with code 1
Output:

> electron-react-boilerplate@1.0.0 postinstall /Users/nyc/Desktop/Electron/Project/app
> npm run electron-rebuild


> electron-react-boilerplate@1.0.0 electron-rebuild /Users/nyc/Desktop/Electron/Project/app
> node -r babel-register ../internals/scripts/ElectronRebuild.js


Error output:

An unhandled error occurred inside electron-rebuild
CXX(target) Release/obj.target/binding/src/binding.o
../src/binding.cc:360:23: warning: 'Utf8Value' is deprecated [-Wdeprecated-declarations]
String::Utf8Value str(in);
^
/Users/nyc/.electron-gyp/iojs-3.0.0-beta.3/deps/v8/include/v8.h:2819:5: note: 'Utf8Value' has been explicitly marked deprecated here
V8_DEPRECATED("Use Isolate version",
^
/Users/nyc/.electron-gyp/iojs-3.0.0-beta.3/deps/v8/include/v8config.h:321:29: note: expanded from macro 'V8_DEPRECATED'
declarator __attribute__((deprecated))
^
../src/binding.cc:435:23: warning: 'Utf8Value' is deprecated [-Wdeprecated-declarations]
String::Utf8Value str(in);
^
/Users/nyc/.electron-gyp/iojs-3.0.0-beta.3/deps/v8/include/v8.h:2819:5: note: 'Utf8Value' has been explicitly marked deprecated here
V8_DEPRECATED("Use Isolate version",
^
/Users/nyc/.electron-gyp/iojs-3.0.0-beta.3/deps/v8/include/v8config.h:321:29: note: expanded from macro 'V8_DEPRECATED'
declarator __attribute__((deprecated))
^
../src/binding.cc:619:11: error: no member named 'ForceSet' in 'v8::Object'
target->ForceSet(Nan::New<v8::String>("endianness").ToLocalChecked(), Nan::New<v8::String>(CheckEndianness()).ToLocalChecked(), static_cast<PropertyAttribute>(ReadOnly|DontDelete));
~~~~~~ ^
../src/binding.cc:620:11: error: no member named 'ForceSet' in 'v8::Object'
target->ForceSet(Nan::New<v8::String>("NULL").ToLocalChecked(), WrapNullPointer(), static_cast<PropertyAttribute>(ReadOnly|DontDelete));
~~~~~~ ^

有什么办法可以避免这个错误吗?

最佳答案

这可能是 nan 库的问题。如果是这样,卸载它并安装最新版本将解决问题:

npm uninstall nan
npm install https://github.com/nodejs/nan

关于node.js - 没有名为 ForceSet 的成员,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51886062/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com