Open ancodeUDW opened 6 years ago
Hi @ancodeUDW - I recently ran into this too... I was able to resolve the issue by updating to node version 10.5.0 (the latest; not LTS). I tried LTS and it didn't work either
Can you try updating node to see if that works?
Hello, @bsclifton
unfortunately, I cannot update Node version, due the project being an electron project, so I am forced to keep the same version that electron uses (if not it won't work).
Same here, electron application and facing a lot of problems.
any updates on this, we need a fix for this
@ancodeUDW the version of node used by electron shouldn't matter, right? Since node is compiled into electron. Are you building electron from source?
ex: Brave is an electron app (well, we forked electron and diverged) which is using Node 7.9.0. But locally, I have node v8.11.2 installed. Using nvm, I switched to the latest (10.5.0) and was able to get it working
With node 10.6.0 I can't install ad-block (on osx and ubuntu 16.04):
osx:
../BloomFilterWrap.cpp:72:21: error: no matching constructor for initialization of
'String::Utf8Value'
String::Utf8Value str(isolate, args[0]->ToString());
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/cjr/.node-gyp/iojs-1.6.11/deps/v8/include/v8.h:2624:14: note: candidate constructor not
viable: requires single argument 'obj', but 2 arguments were provided
explicit Utf8Value(Local<v8::Value> obj);
^
/Users/cjr/.node-gyp/iojs-1.6.11/deps/v8/include/v8.h:2631:5: note: candidate constructor not viable:
requires 1 argument, but 2 were provided
Utf8Value(const Utf8Value&) = delete;
^
../BloomFilterWrap.cpp:81:21: error: no matching constructor for initialization of
'String::Utf8Value'
String::Utf8Value str(isolate, args[0]->ToString());
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/cjr/.node-gyp/iojs-1.6.11/deps/v8/include/v8.h:2624:14: note: candidate constructor not
viable: requires single argument 'obj', but 2 arguments were provided
explicit Utf8Value(Local<v8::Value> obj);
^
/Users/cjr/.node-gyp/iojs-1.6.11/deps/v8/include/v8.h:2631:5: note: candidate constructor not viable:
requires 1 argument, but 2 were provided
Utf8Value(const Utf8Value&) = delete;
^
2 errors generated.
make: *** [Release/obj.target/bloom-filter-cpp/BloomFilterWrap.o] Error 1
and ubuntu:
../BloomFilterWrap.cpp: In static member function 'static void BloomFilterWrap::BloomFilterWrap::Add(const v8::FunctionCallbackInfo<v8::Value>&) ':
../BloomFilterWrap.cpp:72:53: error: no matching function for call to 'v8::String::Utf8Value::Utf8Value(v8::Isolate*&, v8::Local<v8::String>)'
String::Utf8Value str(isolate, args[0]->ToString());
^
In file included from /home/ubuntu/.node-gyp/iojs-1.6.11/src/node.h:42:0,
from ../BloomFilterWrap.h:9,
from ../BloomFilterWrap.cpp:6:
/home/ubuntu/.node-gyp/iojs-1.6.11/deps/v8/include/v8.h:2624:14: note: candidate: v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)
explicit Utf8Value(Local<v8::Value> obj);
^
/home/ubuntu/.node-gyp/iojs-1.6.11/deps/v8/include/v8.h:2624:14: note: candidate expects 1 argument, 2 provided
../BloomFilterWrap.cpp: In static member function 'static void BloomFilterWrap::BloomFilterWrap::Exists(const v8::FunctionCallbackInfo<v8::Value>&)':
../BloomFilterWrap.cpp:81:53: error: no matching function for call to 'v8::String::Utf8Value::Utf8Value(v8::Isolate*&, v8::Local<v8::String>)'
String::Utf8Value str(isolate, args[0]->ToString());
^
In file included from /home/ubuntu/.node-gyp/iojs-1.6.11/src/node.h:42:0,
from ../BloomFilterWrap.h:9,
from ../BloomFilterWrap.cpp:6:
/home/ubuntu/.node-gyp/iojs-1.6.11/deps/v8/include/v8.h:2624:14: note: candidate: v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)
explicit Utf8Value(Local<v8::Value> obj);
^
/home/ubuntu/.node-gyp/iojs-1.6.11/deps/v8/include/v8.h:2624:14: note: candidate expects 1 argument, 2 provided
bloom-filter-cpp.target.mk:99: recipe for target 'Release/obj.target/bloom-filter-cpp/BloomFilterWrap.o' failed
make: *** [Release/obj.target/bloom-filter-cpp/BloomFilterWrap.o] Error 1
It would be great if we could downgrade to use an older version of adblock to avoid this issue until it is fixed.
The problem, however, is that I believe the npm preinstall script in adblock always blindly installs the latest version of bloom-filter-cpp
and hashset-cpp
regardless of the version of adblock.
package.json:
...
"preinstall": "npm install bloom-filter-cpp && npm install hashset-cpp",
....
@cjroebuck one solution would be to fork the project and make the changes. However, somehow, I haven't been able to successfully run electron-rebuild
uptil now.
@cjroebuck with the proper version of node now installed, can you please try deleting your ~/.node-gyp/
folder? I suspect it has corrupt files from before
@cjroebuck @mailtokartik1 When I faced this problem, I did a fork and I tried to force bloom-filter-cpp and hashset-cpp to the last working version
(as @cjroebuck mentions, it doesn't matter the version that its stated in the package.json or in the package-lock.json, the build script has a hardcoded "npm install bloom-filter && npm install hashset-cpp", so in my fork I had to force the version in there as well).
However, it kept giving troubles internally because it looks like the updates from those 2 files were also added to the adblock core itself, so the only way I could make it work was to not only force those modules to the last working version, but also to revert to a early commit that doesn't have those changes as well.
@bsclifton so far I know electron's node matters, because in the end, when we will do the electron release, the program will be installed in computers that do not have node, and electron uses its own version, so its important to keep modules compatibles with it. Update the node inside electron is not recommended, so instead its a matter of waiting until electron updates their project. For this reason, we use electron-rebuild in my project, that it ensures all native modules are compiled to electron's node, ignoring the external node we might have in our computer. However, I will try to not to force electron node and to install the last node as you suggested, to see what happens, whenever I have time.
Hello. I am using brave ad-block in a project, and it was working properly until yesterday that I updated it. My operative system is Ubuntu 16.04.4 LTS.
After several hours looking what was wrong, I found that there was an update in ad-block, bloom-filter-cpp and hashset-cpp that makes it fails to compile when you do an npm install or an electron-rebuild.
I managed to figure out that bloom-filter-cpp@1.18 and hashset-cpp@2.0.1 can be compiled whitout problem, however later versions won't work. However, I could not force ad-block to be installed with those versions due the "preinstall" script installing the last versions anyway, ad-block wont finish the install and wont work.
In order to fix the issue, I did a fork of the project so I could force the "preinstall" script to install the versions that do work, however, after doing that, if well both modules can be installed properly, it still breaks at the end of the installation. The only way i had to fix that is to revert back to commit 5377ddea390a0641d99556e0cf9d9c15b8ef275c, in where, if I force bloom-filter-cpp@1.18 and hashset-cpp@2.0.1, it compiles and works again.
The error message that gives me after doing npm install is the following:
If you force Bloom-filter-cpp to be version 1.1.8, hashset-cpp and ad-block returns similar errors by their own, and, as I mention, the only way I was able to make it work was forcing also hashset-ccp to be 2.0.1 and using ad-block with the commit 5377ddea390a0641d99556e0cf9d9c15b8ef275c
Thank you