openwallet-foundation / credo-ts

Typescript framework for building decentralized identity and verifiable credential solutions
https://credo.js.org
Apache License 2.0
266 stars 200 forks source link

Encountering Installation Issues with @aries-framework/node@0.3.3: node-gyp & ffi-napi Errors #1860

Closed kiranparajuli589 closed 6 months ago

kiranparajuli589 commented 6 months ago

Summary

Encountering node-gyp & ffi-napi issues while installing @aries-framework/node@0.3.3.

This was previously functioning normally, now consistently encountering errors during installation.

Context

Here is the reproducible Dockerfile

Logs

yarn add @aries-framework/node@0.3.0
yarn add v1.22.22
[1/5] Validating package.json...
[2/5] Resolving packages...
warning @aries-framework/node > indy-sdk > node-gyp > make-fetch-happen > cacache > @npmcli/move-file@1.1.2: This functionality has been moved to @npmcli/fs
[3/5] Fetching packages...
[4/5] Linking dependencies...
warning "@aries-framework/core > @digitalcredentials/jsonld-signatures > isomorphic-webcrypto > expo-random@14.0.1" has unmet peer dependency "expo@*".
warning "@aries-framework/core > @digitalcredentials/jsonld-signatures > isomorphic-webcrypto > react-native-securerandom@0.1.1" has unmet peer dependency "react-native@*".
warning " > @cucumber/pretty-formatter@1.0.1" has unmet peer dependency "@cucumber/messages@*".
[5/5] Building fresh packages...
[-/5] ⠂ waiting...
[-/5] ⠂ waiting...
[3/5] ⠂ indy-sdk
[-/5] ⠂ waiting...
error /app/node_modules/indy-sdk: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments: 
Directory: /app/node_modules/indy-sdk
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@8.4.1
gyp info using node@18.19.0 | linux | x64
gyp info find Python using Python version 3.10.12 found at "/usr/bin/python3"
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/app/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   '/app/node_modules/indy-sdk/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/app/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/root/.cache/node-gyp/18.19.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=/root/.cache/node-gyp/18.19.0',
gyp info spawn args   '-Dnode_gyp_dir=/app/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/18.19.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/app/node_modules/indy-sdk',
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' ]
make: Entering directory '/app/node_modules/indy-sdk/build'
  CXX(target) Release/obj.target/indynodejs/src/indy.o
../src/indy.cc: In static member function 'static void IndyCallback::onMainLoopReentry(uv_async_t*)':
../src/indy.cc:236:33: warning: ignoring return value of 'v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)', declared with attribute 'warn_unused_result' [-Wunused-result]
  236 |                 (void)tuple->Set(context, 0, Nan::New<v8::Number>(icb->handle0));
      |                       ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/.cache/node-gyp/18.19.0/include/node/v8-array-buffer.h:13,
                 from /root/.cache/node-gyp/18.19.0/include/node/v8.h:24,
                 from /root/.cache/node-gyp/18.19.0/include/node/node.h:73,
                 from ../../nan/nan.h:62,
                 from ../src/indy.cc:4:
/root/.cache/node-gyp/18.19.0/include/node/v8-object.h:247:37: note: declared here
  247 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
      |                                     ^~~
../src/indy.cc:237:33: warning: ignoring return value of 'v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)', declared with attribute 'warn_unused_result' [-Wunused-result]
  237 |                 (void)tuple->Set(context, 1, Nan::New<v8::Number>(icb->u32int0));
      |                       ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/.cache/node-gyp/18.19.0/include/node/v8-array-buffer.h:13,
                 from /root/.cache/node-gyp/18.19.0/include/node/v8.h:24,
                 from /root/.cache/node-gyp/18.19.0/include/node/node.h:73,
                 from ../../nan/nan.h:62,
                 from ../src/indy.cc:4:
/root/.cache/node-gyp/18.19.0/include/node/v8-object.h:247:37: note: declared here
  247 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
      |                                     ^~~
../src/indy.cc:245:33: warning: ignoring return value of 'v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)', declared with attribute 'warn_unused_result' [-Wunused-result]
  245 |                 (void)tuple->Set(context, 0, toJSString(icb->str0));
      |                       ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/.cache/node-gyp/18.19.0/include/node/v8-array-buffer.h:13,
                 from /root/.cache/node-gyp/18.19.0/include/node/v8.h:24,
                 from /root/.cache/node-gyp/18.19.0/include/node/node.h:73,
                 from ../../nan/nan.h:62,
                 from ../src/indy.cc:4:
/root/.cache/node-gyp/18.19.0/include/node/v8-object.h:247:37: note: declared here
  247 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
      |                                     ^~~
../src/indy.cc:246:33: warning: ignoring return value of 'v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)', declared with attribute 'warn_unused_result' [-Wunused-result]
  246 |                 (void)tuple->Set(context, 1, Nan::New<v8::Number>(icb->i64int0));
      |                       ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/.cache/node-gyp/18.19.0/include/node/v8-array-buffer.h:13,
                 from /root/.cache/node-gyp/18.19.0/include/node/v8.h:24,
                 from /root/.cache/node-gyp/18.19.0/include/node/node.h:73,
                 from ../../nan/nan.h:62,
                 from ../src/indy.cc:4:
/root/.cache/node-gyp/18.19.0/include/node/v8-object.h:247:37: note: declared here
  247 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
      |                                     ^~~
../src/indy.cc:254:33: warning: ignoring return value of 'v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)', declared with attribute 'warn_unused_result' [-Wunused-result]
  254 |                 (void)tuple->Set(context, 0, toJSString(icb->str0));
      |                       ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/.cache/node-gyp/18.19.0/include/node/v8-array-buffer.h:13,
                 from /root/.cache/node-gyp/18.19.0/include/node/v8.h:24,
                 from /root/.cache/node-gyp/18.19.0/include/node/node.h:73,
                 from ../../nan/nan.h:62,
                 from ../src/indy.cc:4:
/root/.cache/node-gyp/18.19.0/include/node/v8-object.h:247:37: note: declared here
  247 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
      |                                     ^~~
../src/indy.cc:255:33: warning: ignoring return value of 'v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)', declared with attribute 'warn_unused_result' [-Wunused-result]
  255 |                 (void)tuple->Set(context, 1, Nan::NewBuffer(icb->buffer0data, icb->buffer0len).ToLocalChecked());
      |                       ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/.cache/node-gyp/18.19.0/include/node/v8-array-buffer.h:13,
                 from /root/.cache/node-gyp/18.19.0/include/node/v8.h:24,
                 from /root/.cache/node-gyp/18.19.0/include/node/node.h:73,
                 from ../../nan/nan.h:62,
                 from ../src/indy.cc:4:
/root/.cache/node-gyp/18.19.0/include/node/v8-object.h:247:37: note: declared here
  247 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
      |                                     ^~~
../src/indy.cc:260:33: warning: ignoring return value of 'v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)', declared with attribute 'warn_unused_result' [-Wunused-result]
  260 |                 (void)tuple->Set(context, 0, toJSString(icb->str0));
      |                       ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/.cache/node-gyp/18.19.0/include/node/v8-array-buffer.h:13,
                 from /root/.cache/node-gyp/18.19.0/include/node/v8.h:24,
                 from /root/.cache/node-gyp/18.19.0/include/node/node.h:73,
                 from ../../nan/nan.h:62,
                 from ../src/indy.cc:4:
/root/.cache/node-gyp/18.19.0/include/node/v8-object.h:247:37: note: declared here
  247 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
      |                                     ^~~
../src/indy.cc:261:33: warning: ignoring return value of 'v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)', declared with attribute 'warn_unused_result' [-Wunused-result]
  261 |                 (void)tuple->Set(context, 1, toJSString(icb->str1));
      |                       ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/.cache/node-gyp/18.19.0/include/node/v8-array-buffer.h:13,
                 from /root/.cache/node-gyp/18.19.0/include/node/v8.h:24,
                 from /root/.cache/node-gyp/18.19.0/include/node/node.h:73,
                 from ../../nan/nan.h:62,
                 from ../src/indy.cc:4:
/root/.cache/node-gyp/18.19.0/include/node/v8-object.h:247:37: note: declared here
  247 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
      |                                     ^~~
../src/indy.cc:266:33: warning: ignoring return value of 'v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)', declared with attribute 'warn_unused_result' [-Wunused-result]
  266 |                 (void)tuple->Set(context, 0, toJSString(icb->str0));
      |                       ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/.cache/node-gyp/18.19.0/include/node/v8-array-buffer.h:13,
                 from /root/.cache/node-gyp/18.19.0/include/node/v8.h:24,
                 from /root/.cache/node-gyp/18.19.0/include/node/node.h:73,
                 from ../../nan/nan.h:62,
                 from ../src/indy.cc:4:
/root/.cache/node-gyp/18.19.0/include/node/v8-object.h:247:37: note: declared here
  247 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
      |                                     ^~~
../src/indy.cc:267:33: warning: ignoring return value of 'v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)', declared with attribute 'warn_unused_result' [-Wunused-result]
  267 |                 (void)tuple->Set(context, 1, toJSString(icb->str1));
      |                       ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/.cache/node-gyp/18.19.0/include/node/v8-array-buffer.h:13,
                 from /root/.cache/node-gyp/18.19.0/include/node/v8.h:24,
                 from /root/.cache/node-gyp/18.19.0/include/node/node.h:73,
                 from ../../nan/nan.h:62,
                 from ../src/indy.cc:4:
/root/.cache/node-gyp/18.19.0/include/node/v8-object.h:247:37: note: declared here
  247 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
      |                                     ^~~
../src/indy.cc:268:33: warning: ignoring return value of 'v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)', declared with attribute 'warn_unused_result' [-Wunused-result]
  268 |                 (void)tuple->Set(context, 2, Nan::New<v8::Number>(icb->timestamp0));
      |                       ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/.cache/node-gyp/18.19.0/include/node/v8-array-buffer.h:13,
                 from /root/.cache/node-gyp/18.19.0/include/node/v8.h:24,
                 from /root/.cache/node-gyp/18.19.0/include/node/node.h:73,
                 from ../../nan/nan.h:62,
                 from ../src/indy.cc:4:
/root/.cache/node-gyp/18.19.0/include/node/v8-object.h:247:37: note: declared here
  247 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
      |                                     ^~~
../src/indy.cc:273:33: warning: ignoring return value of 'v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)', declared with attribute 'warn_unused_result' [-Wunused-result]
  273 |                 (void)tuple->Set(context, 0, toJSString(icb->str0));
      |                       ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/.cache/node-gyp/18.19.0/include/node/v8-array-buffer.h:13,
                 from /root/.cache/node-gyp/18.19.0/include/node/v8.h:24,
                 from /root/.cache/node-gyp/18.19.0/include/node/node.h:73,
                 from ../../nan/nan.h:62,
                 from ../src/indy.cc:4:
/root/.cache/node-gyp/18.19.0/include/node/v8-object.h:247:37: note: declared here
  247 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
      |                                     ^~~
../src/indy.cc:274:33: warning: ignoring return value of 'v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)', declared with attribute 'warn_unused_result' [-Wunused-result]
  274 |                 (void)tuple->Set(context, 1, toJSString(icb->str1));
      |                       ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/.cache/node-gyp/18.19.0/include/node/v8-array-buffer.h:13,
                 from /root/.cache/node-gyp/18.19.0/include/node/v8.h:24,
                 from /root/.cache/node-gyp/18.19.0/include/node/node.h:73,
                 from ../../nan/nan.h:62,
                 from ../src/indy.cc:4:
/root/.cache/node-gyp/18.19.0/include/node/v8-object.h:247:37: note: declared here
  247 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
      |                                     ^~~
../src/indy.cc:275:33: warning: ignoring return value of 'v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)', declared with attribute 'warn_unused_result' [-Wunused-result]
  275 |                 (void)tuple->Set(context, 2, toJSString(icb->str2));
      |                       ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/.cache/node-gyp/18.19.0/include/node/v8-array-buffer.h:13,
                 from /root/.cache/node-gyp/18.19.0/include/node/v8.h:24,
                 from /root/.cache/node-gyp/18.19.0/include/node/node.h:73,
                 from ../../nan/nan.h:62,
                 from ../src/indy.cc:4:
/root/.cache/node-gyp/18.19.0/include/node/v8-object.h:247:37: note: declared here
  247 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
      |                                     ^~~
In file included from ../../nan/nan.h:62,
                 from ../src/indy.cc:4:
../src/indy.cc: At global scope:
/root/.cache/node-gyp/18.19.0/include/node/node.h:1014:7: 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]
 1014 |       (node::addon_register_func) (regfunc),                          \
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/root/.cache/node-gyp/18.19.0/include/node/node.h:1048:3: note: in expansion of macro 'NODE_MODULE_X'
 1048 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
      |   ^~~~~~~~~~~~~
../src/indy.cc:3835:1: note: in expansion of macro 'NODE_MODULE'
 3835 | NODE_MODULE(indynodejs, InitAll)
      | ^~~~~~~~~~~
In file included from /usr/include/string.h:535,
                 from /root/.cache/node-gyp/18.19.0/include/node/v8-internal.h:10,
                 from /root/.cache/node-gyp/18.19.0/include/node/v8-local-handle.h:12,
                 from /root/.cache/node-gyp/18.19.0/include/node/v8-array-buffer.h:12,
                 from /root/.cache/node-gyp/18.19.0/include/node/v8.h:24,
                 from /root/.cache/node-gyp/18.19.0/include/node/node.h:73,
                 from ../../nan/nan.h:62,
                 from ../src/indy.cc:4:
In function 'char* strncpy(char*, const char*, size_t)',
    inlined from 'char* copyCStr(const char*)' at ../src/indy.cc:13:12:
/usr/include/x86_64-linux-gnu/bits/string_fortified.h:95:34: warning: 'char* __builtin_strncpy(char*, const char*, long unsigned int)' output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
   95 |   return __builtin___strncpy_chk (__dest, __src, __len,
      |          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
   96 |                                   __glibc_objsize (__dest));
      |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~
../src/indy.cc: In function 'char* copyCStr(const char*)':
../src/indy.cc:11:24: note: length computed here
   11 |     size_t len = strlen(original);
      |                  ~~~~~~^~~~~~~~~~
  SOLINK_MODULE(target) Release/obj.target/indynodejs.node
/usr/bin/ld: cannot find -lindy: No such file or directory
collect2: error: ld returned 1 exit status
make: *** [indynodejs.target.mk:148: Release/obj.target/indynodejs.node] Error 1
make: Leaving directory '/app/node_modules/indy-sdk/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/app/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:517:28)
gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:292:12)
gyp ERR! System Linux 6.5.0-1020-oem
gyp ERR! command "/root/.nvm/versions/node/v18.19.0/bin/node" "/app/node_modules/indy-sdk/node_modules/.bin/node-gyp" "rebuild"
gyp ERR! cwd /app/node_modules/indy-sdk

Thank you for the help in advance.

TimoGlastra commented 6 months ago

You need to pin Node to version 18.18 i believe (but might be 18.16/18.17). This is fixed in latest Credo release but as you’re using an older credo version you need to downgrade your node version

kiranparajuli589 commented 6 months ago

You need to pin Node to version 18.18 i believe (but might be 18.16/18.17). This is fixed in latest Credo release but as you’re using an older credo version you need to downgrade your node version

Thank you @TimoGlastra, The issue is resolved after I used node v18.18.0. :rocket: :partying_face: