No member named ForceSet

此生再无相见时 提交于 2019-12-14 01:17:37

问题


I'm playing with NodeJS and Electron. Using node 10.9.0 and boilerplate named electron-react-boilerplate.

All of the NodeJS dependencies that I have installed were working correctly, but I need a native module to be installed. The boilerplate docs says to install native modules in the /app directory and so I did, but it threw me:

../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));
  ~~~~~~ 

I've switched my node version to 8.11.3 with deleting all of the installed node_modules and package-lock.json files and installed the native module first - the installation went through.

Then I switched to install my modules in the root directory and I got:

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));
  ~~~~~~  ^

Is there any way I can avoid this error?


回答1:


This is possibly a problem with nan library. If so, uninstalling this and installing the latest version will solve the problem:

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



回答2:


I also experienced this. Apparently, some packages have problems with node v10. I didn't really go deep with why that is the case. Fixed this by using a lower version of node npm install 7.10.0.



来源:https://stackoverflow.com/questions/51886062/no-member-named-forceset

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!