'Error running install script for optional dependency ~/iltorb: Command failed

I need to setup a React project for which I want to install some Node dependencies.

I ran yarn and got some errors; initially I thought the issue may relate to a conflict of version.

So I changed the version and still I am getting the same errors.

I'm currently using nvm version 0.31.3, npm version 6.11.3 and node version 12.11.1.

What might me the problem ? Thanks in advance.

Below is the error I get;

[8/11] ⠠ iltorb
[-/11] ⠠ waiting...
[-/11] ⠠ waiting...
[11/11] ⠠ puppeteer
warning Error running install script for optional dependency: "~/node_modules/iltorb: Command failed.
Exit code: 1
Command: detect-libc prebuild-install || node-gyp rebuild
Arguments: 
Directory: ~/node_modules/iltorb
Output:
prebuild-install WARN install No prebuilt binaries found (target=12.11.1 runtime=node arch=x64 platform=darwin)
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp info spawn /usr/bin/python2
gyp info spawn args [
gyp info spawn args   '~/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   '~/node_modules/iltorb/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '~/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '~/.node-gyp/12.11.1/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=~/.node-gyp/12.11.1',
gyp info spawn args   '-Dnode_gyp_dir=~/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=~/.node-gyp/12.11.1/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=~/node_modules/iltorb',
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 WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CC(target) Release/obj.target/iltorb/brotli/common/dictionary.o
  CC(target) Release/obj.target/iltorb/brotli/dec/bit_reader.o
  CC(target) Release/obj.target/iltorb/brotli/dec/decode.o
  CC(target) Release/obj.target/iltorb/brotli/dec/huffman.o
  CC(target) Release/obj.target/iltorb/brotli/dec/state.o
  CC(target) Release/obj.target/iltorb/brotli/enc/backward_references.o
  CC(target) Release/obj.target/iltorb/brotli/enc/backward_references_hq.o
  CC(target) Release/obj.target/iltorb/brotli/enc/bit_cost.o
  CC(target) Release/obj.target/iltorb/brotli/enc/block_splitter.o
  CC(target) Release/obj.target/iltorb/brotli/enc/brotli_bit_stream.o
  CC(target) Release/obj.target/iltorb/brotli/enc/cluster.o
  CC(target) Release/obj.target/iltorb/brotli/enc/compress_fragment.o
  CC(target) Release/obj.target/iltorb/brotli/enc/compress_fragment_two_pass.o
  CC(target) Release/obj.target/iltorb/brotli/enc/dictionary_hash.o
  CC(target) Release/obj.target/iltorb/brotli/enc/encode.o
  CC(target) Release/obj.target/iltorb/brotli/enc/entropy_encode.o
  CC(target) Release/obj.target/iltorb/brotli/enc/histogram.o
  CC(target) Release/obj.target/iltorb/brotli/enc/literal_cost.o
  CC(target) Release/obj.target/iltorb/brotli/enc/memory.o
  CC(target) Release/obj.target/iltorb/brotli/enc/metablock.o
  CC(target) Release/obj.target/iltorb/brotli/enc/static_dict.o
  CC(target) Release/obj.target/iltorb/brotli/enc/utf8_util.o
  CXX(target) Release/obj.target/iltorb/src/common/allocator.o
  CXX(target) Release/obj.target/iltorb/src/common/stream_coder.o
  CXX(target) Release/obj.target/iltorb/src/dec/stream_decode.o
../src/dec/stream_decode.cc:14:72: error: no matching member function for call to 'ToObject'
    Local<Object> dictionary = Nan::Get(params, key).ToLocalChecked()->ToObject();
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
~/.node-gyp/12.11.1/include/node/v8.h:2576:44: note: candidate function not viable: requires single argument 'context', but no arguments were provided
  V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
                                           ^
~/.node-gyp/12.11.1/include/node/v8.h:2590:31: note: candidate function not viable: requires single argument 'isolate', but no arguments were provided
                Local<Object> ToObject(Isolate* isolate) const);
                              ^
../src/dec/stream_decode.cc:40:49: error: no matching member function for call to 'ToObject'
  StreamDecode* obj = new StreamDecode(info[0]->ToObject());
                                       ~~~~~~~~~^~~~~~~~
~/.node-gyp/12.11.1/include/node/v8.h:2576:44: note: candidate function not viable: requires single argument 'context', but no arguments were provided
  V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
                                           ^
~/.node-gyp/12.11.1/include/node/v8.h:2590:31: note: candidate function not viable: requires single argument 'isolate', but no arguments were provided
                Local<Object> ToObject(Isolate* isolate) const);
                              ^
../src/dec/stream_decode.cc:48:35: error: no matching member function for call to 'ToObject'
  Local<Object> buffer = info[0]->ToObject();
                         ~~~~~~~~~^~~~~~~~
~/.node-gyp/12.11.1/include/node/v8.h:2576:44: note: candidate function not viable: requires single argument 'context', but no arguments were provided
  V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
                                           ^
~/.node-gyp/12.11.1/include/node/v8.h:2590:31: note: candidate function not viable: requires single argument 'isolate', but no arguments were provided
                Local<Object> ToObject(Isolate* isolate) const);
                              ^
../src/dec/stream_decode.cc:54:16: error: no matching member function for call to 'BooleanValue'
  if (info[2]->BooleanValue()) {
      ~~~~~~~~~^~~~~~~~~~~~
~/.node-gyp/12.11.1/include/node/v8.h:2603:8: note: candidate function not viable: requires single argument 'isolate', but no arguments were provided
  bool BooleanValue(Isolate* isolate) const;
       ^
~/.node-gyp/12.11.1/include/node/v8.h:2606:51: note: candidate function not viable: requires single argument 'context', but no arguments were provided
                V8_WARN_UNUSED_RESULT Maybe<bool> BooleanValue(
                                                  ^
../src/dec/stream_decode.cc:70:16: error: no matching member function for call to 'BooleanValue'
  if (info[1]->BooleanValue()) {
      ~~~~~~~~~^~~~~~~~~~~~
~/.node-gyp/12.11.1/include/node/v8.h:2603:8: note: candidate function not viable: requires single argument 'isolate', but no arguments were provided
  bool BooleanValue(Isolate* isolate) const;
       ^
~/.node-gyp/12.11.1/include/node/v8.h:2606:51: note: candidate function not viable: requires single argument 'context', but no arguments were provided
                V8_WARN_UNUSED_RESULT Maybe<bool> BooleanValue(
                                                  ^
5 errors generated.
make: *** [Release/obj.target/iltorb/src/dec/stream_decode.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (~/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 19.4.0
gyp ERR! command \"~/.nvm/versions/node/v12.11.1/bin/node\" \"~/node_modules/iltorb/node_modules/.bin/node-gyp\" \"rebuild\"
gyp ERR! cwd ~/node_modules/iltorb
[8/11] ⠄ iltorb
[-/11] ⠄ waiting...
[-/11] ⠄ waiting...
[11/11] ⠄ puppeteer
^C/11] ⠄ waiting...


Solution 1:[1]

This is not a great answer, but I've hit this before too and "solved" it by downgrading to node v10

Solution 2:[2]

For me bundlesize had dependency on iltorb

It gave below error:

[4/4] Building fresh packages...
error node_modules\iltorb: Command failed.
Exit code: 7
Command: detect-libc prebuild-install || node-gyp rebuild

Upgrading bundlesize package to latest worked, screenshot below:

Upgrade bundlesize package

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jeffrey Knight
Solution 2 Manohar Reddy Poreddy