Electron 7 fails to build native modules - electron

I'm building an electron app that is running native modules. I upgraded to Electron 7 but since then I'm getting the following error when I'm building the app using electron-forge.
I also upgraded my node version to 12.8.1.
In order to load native modules, I'm using a fork of node-ffi.
How do I fix that?
Thanks!
An unhandled error has occurred inside Forge:
gyp info it worked if it ends with ok
gyp info using node-gyp#5.0.5
gyp info using node#12.8.1 | darwin | x64
gyp info find Python using Python version 2.7.16 found at "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python"
gyp info spawn /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
gyp info spawn args [
gyp info spawn args '/Users/rani/Documents/Code/Saleae/monorepo/packages/electron/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/Users/rani/Documents/Code/Saleae/monorepo/packages/electron/node_modules/ref/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/rani/Documents/Code/Saleae/monorepo/packages/electron/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/rani/.electron-gyp/7.1.0/include/node/common.gypi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=/Users/rani/.electron-gyp/7.1.0',
gyp info spawn args '-Dnode_gyp_dir=/Users/rani/Documents/Code/Saleae/monorepo/packages/electron/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/rani/.electron-gyp/7.1.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/rani/Documents/Code/Saleae/monorepo/packages/electron/node_modules/ref',
gyp info spawn args '-Dnode_engine=v8',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'build',
gyp info spawn args '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
CXX(target) Release/obj.target/binding/src/binding.o
../src/binding.cc:222:30: error: no matching member function for call to 'BooleanValue'
bool persistent = info[3]->BooleanValue(v8::Isolate::GetCurrent()->GetCurrentContext()).ToChecked();
~~~~~~~~~^~~~~~~~~~~~
/Users/rani/.electron-gyp/7.1.0/include/node/v8.h:2653:8: note: candidate function not viable: no known conversion from 'Local<v8::Context>' to 'v8::Isolate *' for 1st argument
bool BooleanValue(Isolate* isolate) const;
^
/Users/rani/.electron-gyp/7.1.0/include/node/v8.h:2662:43: note: candidate function not viable: requires 0 arguments, but 1 was provided
V8_DEPRECATED("Use maybe version", bool BooleanValue() const);
^
../src/binding.cc:582:3: error: no matching member function for call to 'Set'
SET_SIZEOF(int8, int8_t);
^~~~~~~~~~~~~~~~~~~~~~~~
../src/binding.cc:581:9: note: expanded from macro 'SET_SIZEOF'
smap->Set(Nan::New<v8::String>( #name ).ToLocalChecked(), Nan::New<v8::Uint32>(static_cast<uint32_t>(sizeof(type))));
~~~~~~^~~
/Users/rani/.electron-gyp/7.1.0/include/node/v8.h:3455:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
^
/Users/rani/.electron-gyp/7.1.0/include/node/v8.h:3458:37: note: candidate function not viable: requires 3 arguments, but 2 were provided
V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
^
../src/binding.cc:583:3: error: no matching member function for call to 'Set'
SET_SIZEOF(uint8, uint8_t);
^~~~~~~~~~~~~~~~~~~~~~~~~~
...

Related

Cannot install opencv4nodejs using npm i -g opencv4nodejs on Mac OS 12.1 with Intel

ARN AppiumDoctor ➜ Why opencv4nodejs is needed and how to install it: https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/image-comparison.md
When I ran Appium doctor - I got the output above.
When I try to install - the error is: /usr/local/lib/node_modules/opencv4nodejs/install/install.js:37
npm ERR! throw new Error('library dir does not exist: ' + libDir)
npm ERR! ^
npm ERR!
npm ERR! Error: library dir does not exist: /usr/local/lib/node_modules/opencv4nodejs/node_modules/opencv-build/opencv/build/lib
npm ERR! at Object. (/usr/local/lib/node_modules/opencv4nodejs/install/install.js:37:9)
npm ERR! at Module._compile (node:internal/modules/cjs/loader:1097:14)
npm ERR! at Object.Module._extensions..js (node:internal/modules/cjs/loader:1149:10)
npm ERR! at Module.load (node:internal/modules/cjs/loader:975:32)
npm ERR! at Function.Module._load (node:internal/modules/cjs/loader:822:12)
npm ERR! at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
npm ERR! at node:internal/main/run_main_module:17:47
npm ERR!
npm ERR! Node.js v17.4.0
My node version is 17.4.0; I have tried switching to version 14 and that did not work.
I have also uninstalled node an reinstalled - that did not work. The same was done for npm. How can I get this installed? Is it still needed to automate my tests on the simulator?

yarn install --check-files giving me error output that I don't understand

I have a Ruby on Rails project that I'm deploying on a freshly set up server.
I run the command rails s -b 0.0.0.0 and it says:
========================================
Your Yarn packages are out of date!
Please run `yarn install --check-files` to update.
========================================
So I run the command it tells me to run, and ultimately it fails with a few errors that I don't really understand:
g++ '-DNODE_GYP_MODULE_NAME=binding' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DBUILDING_NODE_EXTENSION' -I/home/ubuntu/.node-gyp/16.0.0/include/node -I/home/ubuntu/.node-gyp/16.0.0/src -I/home/ubuntu/.node-gyp/16.0.0/deps/openssl/config -I/home/ubuntu/.node-gyp/16.0.0/deps/openssl/openssl/include -I/home/ubuntu/.node-gyp/16.0.0/deps/uv/include -I/home/ubuntu/.node-gyp/16.0.0/deps/zlib -I/home/ubuntu/.node-gyp/16.0.0/deps/v8/include -I../../nan -I../src/libsass/include -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++1y -std=c++0x -MMD -MF ./Release/.deps/Release/obj.target/binding/src/binding.o.d.raw -c -o Release/obj.target/binding/src/binding.o ../src/binding.cpp
In file included from /home/ubuntu/.node-gyp/16.0.0/include/node/v8.h:30,
from /home/ubuntu/.node-gyp/16.0.0/include/node/node.h:63,
from ../../nan/nan.h:56,
from ../src/binding.cpp:1:
/home/ubuntu/.node-gyp/16.0.0/include/node/v8-internal.h: In function ‘void v8::internal::PerformCastCheck(T*)’:
/home/ubuntu/.node-gyp/16.0.0/include/node/v8-internal.h:452:38: error: ‘remove_cv_t’ is not a member of ‘std’; did you mean ‘remove_cv’?
452 | !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
| ^~~~~~~~~~~
| remove_cv
/home/ubuntu/.node-gyp/16.0.0/include/node/v8-internal.h:452:38: error: ‘remove_cv_t’ is not a member of ‘std’; did you mean ‘remove_cv’?
452 | !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
| ^~~~~~~~~~~
| remove_cv
/home/ubuntu/.node-gyp/16.0.0/include/node/v8-internal.h:452:50: error: template argument 2 is invalid
452 | !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
| ^
/home/ubuntu/.node-gyp/16.0.0/include/node/v8-internal.h:452:63: error: ‘::Perform’ has not been declared
452 | !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
| ^~~~~~~
../src/binding.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE render(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/binding.cpp:284:98: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
284 | int status = uv_queue_work(uv_default_loop(), &ctx_w->request, compile_it, (uv_after_work_cb)MakeCallback);
| ^~~~~~~~~~~~
../src/binding.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE render_file(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/binding.cpp:320:98: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
320 | int status = uv_queue_work(uv_default_loop(), &ctx_w->request, compile_it, (uv_after_work_cb)MakeCallback);
| ^~~~~~~~~~~~
In file included from ../../nan/nan.h:56,
from ../src/binding.cpp:1:
../src/binding.cpp: At global scope:
/home/ubuntu/.node-gyp/16.0.0/include/node/node.h:806:43: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
806 | (node::addon_register_func) (regfunc), \
| ^
/home/ubuntu/.node-gyp/16.0.0/include/node/node.h:840:3: note: in expansion of macro ‘NODE_MODULE_X’
840 | NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage)
| ^~~~~~~~~~~~~
../src/binding.cpp:358:1: note: in expansion of macro ‘NODE_MODULE’
358 | NODE_MODULE(binding, RegisterModule);
| ^~~~~~~~~~~
make: *** [binding.target.mk:133: Release/obj.target/binding/src/binding.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/ubuntu/vendsmartsolutions/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack at ChildProcess.emit (node:events:365:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Linux 5.4.0-1038-aws
gyp ERR! command "/home/ubuntu/.nvm/versions/node/v16.0.0/bin/node" "/home/ubuntu/vendsmartsolutions/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/ubuntu/vendsmartsolutions/node_modules/node-sass
gyp ERR! node -v v16.0.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
make: Leaving directory '/home/ubuntu/vendsmartsolutions/node_modules/node-sass/build'
Build failed with error code: 1
I looked it over several times and I really have no idea what any of it means. This project runs fine on my development VM.
Any help would be appreciated, thanks.
It seems like the problem with the version of nodeJS.
I tried node v15 and it works for me, while v16 would fail.
Also, node-sass is deprecated. You should change another library to use.
UPDATE: this is what solved for me and #S.Goswami. Please try that solution first.
If the above solution doesn't work, it might be worth trying what is recommended here, but unfortunately that didn't work for me, or for others, but it could be worth a try if the above solution doesn't work. Here's an outline of the solution that worked for some, but not everyone:
Delete yarn.lock
There's a directory in the root of your rails app called node_modules - delete it. NOTE: if you use sublime text, it won't show directories that simply "house source control information and various binary output files" (lesson learned). Open your app in finder, find yourapp/node_modules/ and delete it.
Run spring stop (I didn't need to do this, but others have recommended it, and it won't hurt).
Now simply reinstall your node modules with yarn install. But, if this step errors, try using yarn install -std=c++17 as found in the help from the comments and #Scheff's answer
node-sass doesn't support Node v16 yet. So for now downgrade Node to v15 will fix these errors. For further updates visit sass/node-sass#3077

npm run migrate asking for password

I'm running into a wall when it comes to migrating to databases. For some reason whenever I try to migrate git bash asks me for a password. A password I never had to enter before.
I don't know what this password could be. I tried my desktop password but that gives me the same error as if I put nothing at all.
$ npm run migrate
express-boilerplate#0.0.1 migrate C:\Users\Zackr\Documents\node\node-todo-get-post
postgrator --config postgrator-config.js
Password:
C:\Users\Zackr\Documents\node\node-todo-get-post\node_modules\postgrator-cli\postgrator-cli.js:187
rl.history = rl.history.slice(1);
^
TypeError: Cannot read property 'slice' of undefined
at C:\Users\Zackr\Documents\node\node-todo-get-post\node_modules\postgrator-cli\postgrator-cli.js:187:33
at Interface._onLine (readline.js:335:5)
at Interface._normalWrite (readline.js:482:12)
at Socket.ondata (readline.js:194:10)
at Socket.emit (events.js:315:20)
at addChunk (internal/streams/readable.js:309:12)
at readableAddChunk (internal/streams/readable.js:284:9)
at Socket.Readable.push (internal/streams/readable.js:223:10)
at Pipe.onStreamRead (internal/stream_base_commons.js:188:23) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR!
express-boilerplate#0.0.1 migrate: postgrator --config postgrator-config.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed
at the express-boilerplate#0.0.1 migrate script. npm ERR! This is
probably not a problem with npm. There is likely additional logging
output above.
npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\Zackr\AppData\Roaming\npm-cache_logs\2021-02-17T21_50_59_429Z-debug.log
Didn't realize that the new version of postgrator-cli requires a password. I rolled back to an earlier version.

Hyperledger Composer v0.20.0 network start error

Composer v0.20.0
Fabric v1.2.1 (docker container)
node v8.15.0
MacOS
I'm running into an error when I try to use the composer network start command. I was following this tutorial: https://hyperledger.github.io/composer/v0.19/tutorials/deploy-to-fabric-single-org
Steps:
1)
cd ~/fabric-dev-servers
export FABRIC_VERSION=hlfv12
./stopFabric.sh
./teardownFabric.sh
./downloadFabric.sh
./startFabric.sh
If I run docker container ls:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
64e6d6746649 hyperledger/fabric-peer:1.2.1 "peer node start" 31 seconds ago Up 30 seconds 0.0.0.0:7051->7051/tcp, 0.0.0.0:7053->7053/tcp peer0.org1.example.com
f2ee3f2a68f7 hyperledger/fabric-couchdb:0.4.10 "tini -- /docker-ent…" 32 seconds ago Up 31 seconds 4369/tcp, 9100/tcp, 0.0.0.0:5984->5984/tcp couchdb
41e9a4987f6f hyperledger/fabric-orderer:1.2.1 "orderer" 32 seconds ago Up 31 seconds 0.0.0.0:7050->7050/tcp orderer.example.com
1673c6691baf hyperledger/fabric-ca:1.2.1 "sh -c 'fabric-ca-se…" 32 seconds ago Up 31 seconds 0.0.0.0:7054->7054/tcp ca.org1.example.com
Then I ran rm -fr ~/.composer
2)
composer card create -p connection.json -u PeerAdmin -c ~/fabric-dev-servers/fabric-scripts/hlfv12/composer/crypto-config/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp/signcerts/Admin#org1.example.com-cert.pem -k ~/fabric-dev-servers/fabric-scripts/hlfv12/composer/crypto-config/peerOrganizations/org1.example.com/users/Admin#org1.example.com/msp/keystore/114aab0e76bf0c78308f89efc4b8c9423e31568da0c340ca187a9b17aa9a4457_sk -r PeerAdmin -r ChannelAdmin
I got this back:
Successfully created business network card file to
Output file: PeerAdmin#mogvl-net.card
Command succeeded
3)
composer card import -f PeerAdmin#mogvl-net.card
I got this back:
Successfully imported business network card
Card file: PeerAdmin#mogvl-net.card
Card name: PeerAdmin#mogvl-net
Command succeeded
4)
composer network install -c PeerAdmin#mogvl-net -a dist/mogvl-network.bna
I got this back:
✔ Installing business network. This may take a minute...
Successfully installed business network mogvl-network, version 0.2.6
Command succeeded
5)
composer network start --networkName mogvl-network --networkVersion 0.2.6 -A admin -S adminpw -c PeerAdmin#mogvl-net
I got this error back:
Starting business network mogvl-network at version 0.2.6
Processing these Network Admins:
userName: admin
✖ Starting business network definition. This may take a minute...
Error: Error trying to start business network. Error: No valid responses from any peers.
Response from attempted peer comms was an error: Error: failed to execute transaction 5de6713450900a4f1ac035bec47136a54c5ce5e03722700c0a85feef782ed738: error starting container: error starting container: Failed to generate platform-specific docker build: Error returned from build: 1 "npm WARN notice [SECURITY] debug has the following vulnerability: 1 low. Go here for more details: https://nodesecurity.io/advisories?search=debug&version=2.6.2 - Run `npm i npm#latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN notice [SECURITY] hoek has the following vulnerability: 1 moderate. Go here for more details: https://nodesecurity.io/advisories?search=hoek&version=2.16.3 - Run `npm i npm#latest -g` to upgrade your npm version, and then `npm audit` to get more info.
npm WARN deprecated boom#2.10.1: This version is no longer maintained. Please upgrade to the latest version.
npm WARN deprecated cryptiles#2.0.5: This version is no longer maintained. Please upgrade to the latest version.
npm WARN deprecated hoek#2.16.3: This version is no longer maintained. Please upgrade to the latest version.
npm WARN deprecated boom#4.3.1: This version is no longer maintained. Please upgrade to the latest version.
> node#11.10.0 preinstall /chaincode/output/node_modules/node
> node installArchSpecificPackage
+ node-linux-x64#11.10.0
added 1 package in 2.904s
> x509#0.3.4 install /chaincode/output/node_modules/x509
> node-gyp rebuild
make: Entering directory '/chaincode/output/node_modules/x509/build'
CXX(target) Release/obj.target/x509/src/addon.o
CXX(target) Release/obj.target/x509/src/x509.o
../src/x509.cc: In function 'std::__cxx11::string parse_args(const Nan::FunctionCallbackInfo<v8::Value>&)':
../src/x509.cc:41:25: warning: 'v8::Local<v8::String> v8::Value::ToString() const' is deprecated: Use maybe version [-Wdeprecated-declarations]
if (info[0]->ToString()->Length() == 0) {
^
In file included from /root/.node-gyp/11.10.0/include/node/node.h:63:0,
from ../include/addon.h:4,
from ../include/x509.h:5,
from ../src/x509.cc:3:
/root/.node-gyp/11.10.0/include/node/v8.h:10248:15: note: declared here
Local<String> Value::ToString() const {
^
../src/x509.cc:46:45: warning: 'v8::Local<v8::String> v8::Value::ToString() const' is deprecated: Use maybe version [-Wdeprecated-declarations]
return *Nan::Utf8String(info[0]->ToString());
^
In file included from /root/.node-gyp/11.10.0/include/node/node.h:63:0,
from ../include/addon.h:4,
from ../include/x509.h:5,
from ../src/x509.cc:3:
/root/.node-gyp/11.10.0/include/node/v8.h:10248:15: note: declared here
Local<String> Value::ToString() const {
^
../src/x509.cc: In function 'Nan::NAN_METHOD_RETURN_TYPE verify(Nan::NAN_METHOD_ARGS_TYPE)':
../src/x509.cc:55:64: warning: 'v8::Local<v8::String> v8::Value::ToString() const' is deprecated: Use maybe version [-Wdeprecated-declarations]
std::string cert_path = *String::Utf8Value(info[0]->ToString());
^
In file included from /root/.node-gyp/11.10.0/include/node/node.h:63:0,
from ../include/addon.h:4,
from ../include/x509.h:5,
from ../src/x509.cc:3:
/root/.node-gyp/11.10.0/include/node/v8.h:10248:15: note: declared here
Local<String> Value::ToString() const {
^
../src/x509.cc:55:65: warning: 'v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)' is deprecated: Use Isolate version [-Wdeprecated-declarations]
std::string cert_path = *String::Utf8Value(info[0]->ToString());
^
In file included from /root/.node-gyp/11.10.0/include/node/v8.h:26:0,
from /root/.node-gyp/11.10.0/include/node/node.h:63,
from ../include/addon.h:4,
from ../include/x509.h:5,
from ../src/x509.cc:3:
/root/.node-gyp/11.10.0/include/node/v8.h:2992:28: note: declared here
explicit Utf8Value(Local<v8::Value> obj));
^
/root/.node-gyp/11.10.0/include/node/v8config.h:326:3: note: in definition of macro 'V8_DEPRECATED'
declarator __attribute__((deprecated(message)))
^
../src/x509.cc:56:67: warning: 'v8::Local<v8::String> v8::Value::ToString() const' is deprecated: Use maybe version [-Wdeprecated-declarations]
std::string ca_bundlestr = *String::Utf8Value(info[1]->ToString());
^
In file included from /root/.node-gyp/11.10.0/include/node/node.h:63:0,
from ../include/addon.h:4,
from ../include/x509.h:5,
from ../src/x509.cc:3:
/root/.node-gyp/11.10.0/include/node/v8.h:10248:15: note: declared here
Local<String> Value::ToString() const {
^
../src/x509.cc:56:68: warning: 'v8::String::Utf8Value::Utf8Value(v8::Local<v8::Value>)' is deprecated: Use Isolate version [-Wdeprecated-declarations]
std::string ca_bundlestr = *String::Utf8Value(info[1]->ToString());
^
In file included from /root/.node-gyp/11.10.0/include/node/v8.h:26:0,
from /root/.node-gyp/11.10.0/include/node/node.h:63,
from ../include/addon.h:4,
from ../include/x509.h:5,
from ../src/x509.cc:3:
/root/.node-gyp/11.10.0/include/node/v8.h:2992:28: note: declared here
explicit Utf8Value(Local<v8::Value> obj));
^
/root/.node-gyp/11.10.0/include/node/v8config.h:326:3: note: in definition of macro 'V8_DEPRECATED'
declarator __attribute__((deprecated(message)))
^
../src/x509.cc: In function 'Nan::NAN_METHOD_RETURN_TYPE get_altnames(Nan::NAN_METHOD_ARGS_TYPE)':
../src/x509.cc:118:57: warning: 'v8::Local<v8::Object> v8::Value::ToObject() const' is deprecated: Use maybe version [-Wdeprecated-declarations]
Local<Object> exports(try_parse(parsed_arg)->ToObject());
^
In file included from /root/.node-gyp/11.10.0/include/node/node.h:63:0,
from ../include/addon.h:4,
from ../include/x509.h:5,
from ../src/x509.cc:3:
/root/.node-gyp/11.10.0/include/node/v8.h:10254:15: note: declared here
Local<Object> Value::ToObject() const {
^
../src/x509.cc: In function 'Nan::NAN_METHOD_RETURN_TYPE get_subject(Nan::NAN_METHOD_ARGS_TYPE)':
../src/x509.cc:131:57: warning: 'v8::Local<v8::Object> v8::Value::ToObject() const' is deprecated: Use maybe version [-Wdeprecated-declarations]
Local<Object> exports(try_parse(parsed_arg)->ToObject());
^
In file included from /root/.node-gyp/11.10.0/include/node/node.h:63:0,
from ../include/addon.h:4,
from ../include/x509.h:5,
from ../src/x509.cc:3:
/root/.node-gyp/11.10.0/include/node/v8.h:10254:15: note: declared here
Local<Object> Value::ToObject() const {
^
../src/x509.cc: In function 'Nan::NAN_METHOD_RETURN_TYPE get_issuer(Nan::NAN_METHOD_ARGS_TYPE)':
../src/x509.cc:144:57: warning: 'v8::Local<v8::Object> v8::Value::ToObject() const' is deprecated: Use maybe version [-Wdeprecated-declarations]
Local<Object> exports(try_parse(parsed_arg)->ToObject());
^
In file included from /root/.node-gyp/11.10.0/include/node/node.h:63:0,
from ../include/addon.h:4,
from ../include/x509.h:5,
from ../src/x509.cc:3:
/root/.node-gyp/11.10.0/include/node/v8.h:10254:15: note: declared here
Local<Object> Value::ToObject() const {
^
../src/x509.cc: In function 'Nan::NAN_METHOD_RETURN_TYPE parse_cert(Nan::NAN_METHOD_ARGS_TYPE)':
../src/x509.cc:157:57: warning: 'v8::Local<v8::Object> v8::Value::ToObject() const' is deprecated: Use maybe version [-Wdeprecated-declarations]
Local<Object> exports(try_parse(parsed_arg)->ToObject());
^
In file included from /root/.node-gyp/11.10.0/include/node/node.h:63:0,
from ../include/addon.h:4,
from ../include/x509.h:5,
from ../src/x509.cc:3:
/root/.node-gyp/11.10.0/include/node/v8.h:10254:15: note: declared here
Local<Object> Value::ToObject() const {
^
../src/x509.cc: In function 'v8::Local<v8::Value> try_parse(const string&)':
../src/x509.cc:398:38: warning: value computed is not used [-Wunused-value]
BIO_set_close(ext_bio, BIO_CLOSE);
^
../src/x509.cc: In function 'v8::Local<v8::Value> parse_date(ASN1_TIME*)':
../src/x509.cc:462:75: warning: 'v8::Local<v8::Object> v8::Value::ToObject() const' is deprecated: Use maybe version [-Wdeprecated-declarations]
Nan::New<String>("Date").ToLocalChecked()).ToLocalChecked()->ToObject();
^
In file included from /root/.node-gyp/11.10.0/include/node/node.h:63:0,
from ../include/addon.h:4,
from ../include/x509.h:5,
from ../src/x509.cc:3:
/root/.node-gyp/11.10.0/include/node/v8.h:10254:15: note: declared here
Local<Object> Value::ToObject() const {
^
SOLINK_MODULE(target) Release/obj.target/x509.node
COPY Release/x509.node
make: Leaving directory '/chaincode/output/node_modules/x509/build'
> grpc#1.10.1 install /chaincode/output/node_modules/grpc
> node-pre-gyp install --fallback-to-build --library=static_library
node-pre-gyp ERR! Tried to download(403): https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc/v1.10.1/node-v67-linux-x64-glibc.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for grpc#1.10.1 and node#11.10.0 (node-v67 ABI, glibc) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Pre-built binaries not installable for grpc#1.10.1 and node#11.10.0 (node-v67 ABI, glibc) (falling back to source compile with node-gyp)
node-pre-gyp ERR! Hit error Connection closed while downloading tarball file
make: Entering directory '/chaincode/output/node_modules/grpc/build'
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
make: Entering directory '/chaincode/output/node_modules/grpc/build'
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/surface/init.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/avl/avl.o
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/avl/avl.o
rm: cannot remove './Release/.deps/Release/obj.target/grpc/deps/grpc/src/core/lib/avl/avl.o.d.raw': No such file or directory
make: *** [Release/obj.target/grpc/deps/grpc/src/core/lib/avl/avl.o] Error 1
grpc.target.mk:388: recipe for target 'Release/obj.target/grpc/deps/grpc/src/core/lib/avl/avl.o' failed
make: Leaving directory '/chaincode/output/node_modules/grpc/build'
CXX(target) Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.o
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at ChildProcess.emit (events.js:197:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Linux 4.9.125-linuxkit
gyp ERR! command "/chaincode/output/node_modules/node/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/chaincode/output/node_modules/grpc/src/node/extension_binary/node-v67-linux-x64-glibc/grpc_node.node" "--module_name=grpc_node" "--module_path=/chaincode/output/node_modules/grpc/src/node/extension_binary/node-v67-linux-x64-glibc"
gyp ERR! cwd /chaincode/output/node_modules/grpc
gyp ERR! node -v v11.10.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/chaincode/output/node_modules/node/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/chaincode/output/node_modules/grpc/src/node/extension_binary/node-v67-linux-x64-glibc/grpc_node.node --module_name=grpc_node --module_path=/chaincode/output/node_modules/grpc/src/node/extension_binary/node-v67-linux-x64-glibc' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/chaincode/output/node_modules/grpc/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:197:13)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:984:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
node-pre-gyp ERR! System Linux 4.9.125-linuxkit
node-pre-gyp ERR! command "/chaincode/output/node_modules/node/bin/node" "/chaincode/output/node_modules/grpc/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--library=static_library"
node-pre-gyp ERR! cwd /chaincode/output/node_modules/grpc
node-pre-gyp ERR! node -v v11.10.0
node-pre-gyp ERR! node-pre-gyp -v v0.7.0
node-pre-gyp ERR! not ok
Failed to execute '/chaincode/output/node_modules/node/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --library=static_library --module=/chaincode/output/node_modules/grpc/src/node/extension_binary/node-v67-linux-x64-glibc/grpc_node.node --module_name=grpc_node --module_path=/chaincode/output/node_modules/grpc/src/node/extension_binary/node-v67-linux-x64-glibc' (1)
../deps/grpc/src/core/lib/backoff/backoff.cc:76:1: fatal error: opening dependency file ./Release/.deps/Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.o.d.raw: No such file or directory
compilation terminated.
grpc.target.mk:388: recipe for target 'Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.o' failed
make: Leaving directory '/chaincode/output/node_modules/grpc/build'
make: *** [Release/obj.target/grpc/deps/grpc/src/core/lib/backoff/backoff.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at ChildProcess.emit (events.js:197:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Linux 4.9.125-linuxkit
gyp ERR! command "/chaincode/output/node_modules/node/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--library=static_library" "--module=/chaincode/output/node_modules/grpc/src/node/extension_binary/node-v67-linux-x64-glibc/grpc_node.node" "--module_name=grpc_node" "--module_path=/chaincode/output/node_modules/grpc/src/node/extension_binary/node-v67-linux-x64-glibc"
gyp ERR! cwd /chaincode/output/node_modules/grpc
gyp ERR! node -v v11.10.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN The package composer-common is included as both a dev and production dependency.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.7 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! grpc#1.10.1 install: `node-pre-gyp install --fallback-to-build --library=static_library`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the grpc#1.10.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-02-22T21_16_38_589Z-debug.log
"
Command failed
I feel like I'm close and all it takes is a minor fix, but I'm not sure.
Seems the problem is the npm version. When the chaincode container start for the first time, the peer node use npm install to download and install the dependencies of the smart contract inside the container (like fabric-shim). Try upgrating your npm version:
npm i npm#latest -g

Hyperledger Fabric - Commercial Paper tutorial - chaincode instantiate error

I have been following the Commercial Paper tutorial from https://hyperledger-fabric.readthedocs.io/en/release-1.4/tutorial/commercial_paper.html
When I instantiate the chaincode by running the following command
docker exec cliMagnetoCorp peer chaincode instantiate -n papercontract -v 0 -l node -c '{"Args":["org.papernet.commercialpaper:instantiate"]}' -C mychannel -P "AND ('Org1MSP.member')"
I get the following error after a few minutes
Error: could not assemble transaction, err proposal response was not successful, error code 500, msg timeout expired while starting chaincode papercontract:0 for transaction
I have been digging down a bit and it seem the "dev-peer0.org1.example.com-papercontract-0" is failing
dev-peer0.org1.example.com-papercontract-0 logs show the following:
dev-peer0.org1.example.com-papercontract-0|npm ERR! path /usr/local/src/package.json
dev-peer0.org1.example.com-papercontract-0|npm ERR! code ENOENT
dev-peer0.org1.example.com-papercontract-0|npm ERR! errno -2
dev-peer0.org1.example.com-papercontract-0|npm ERR! syscall open
dev-peer0.org1.example.com-papercontract-0|npm ERR! enoent ENOENT: no such file or directory, open '/usr/local/src/package.json'
dev-peer0.org1.example.com-papercontract-0|npm ERR! enoent This is related to npm not being able to find a file.
dev-peer0.org1.example.com-papercontract-0|npm ERR! enoent
dev-peer0.org1.example.com-papercontract-0|
dev-peer0.org1.example.com-papercontract-0|npm ERR! A complete log of this run can be found in:
dev-peer0.org1.example.com-papercontract-0|npm ERR! /root/.npm/_logs/2019-02-08T11_51_20_601Z-debug.log
Have been stuck at it for two days, any help would be greatly appreciated!
Edit: The steps before this run smoothly as expected.
Also the first network simulation (./byfn.sh up) runs perfectly fine.
You need the package.json inside the directory of the chaincode. For example, the chaincode directory name is: ./Chaincode , and inside should be chaincode.js and package.json.
In the package.json, on start, in script you should put "node chaincode.js". That because the peer use npm start to execute the chaincode.

Resources