realm-js: Installing realm 3.1.0 fails during node-pre-gyp install --fallback-to-build

I’ve tried installing this on Windows, Ubuntu and MacOS. All fail with the same error.

$ npm install

> realm@3.1.0 install C:\Workspaces\ThreadLearning\thread-rest\node_modules\realm
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp ERR! Completion callback never invoked!
node-pre-gyp ERR! System Windows_NT 10.0.17134
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Workspaces\\ThreadLearning\\thread-rest\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Workspaces\ThreadLearning\thread-rest\node_modules\realm
node-pre-gyp ERR! node -v v10.16.3
node-pre-gyp ERR! node-pre-gyp -v v0.13.0

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 7
  • Comments: 17 (2 by maintainers)

Most upvoted comments

Node v12 is not supported by Realm v3.x as mentioned here: https://github.com/realm/realm-js/issues/2880#issuecomment-628665377

As @markwolff mentioned in mapbox/node-pre-gyp/issues/477

not ideal but a workaround is to manually add "node-pre-gyp": "0.12.0" as a devDev to your package.json

worked for me

for those who are still suffering from this, I solved this by downgrade my Node.js version to v10.18.0. As suggested by @andrekovac , Realm v3.x doesn’t support node12

Which version of node you are using?

In previouse realmjs version node 12 didn’t worked for me. Downgrade to node 10 fixed the issue for me.

This happens reliably with latest yarn with nodejs v12.6.0 and realm version 2.29.2:

First, 404s:

node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@0.11.0
node-pre-gyp info using node@12.6.0 | darwin | x64
node-pre-gyp WARN Using request for node-pre-gyp https download 
node-pre-gyp info check checked for "/Users/thebigredgeek/Projects/boltsource/customers/tractorsupply/react-native/node_modules/realm/compiled/node-v72_darwin_x64/realm.node" (not found)
node-pre-gyp http GET https://static.realm.io/node-pre-gyp/2.29.2/realm-v2.29.2-node-v72-darwin-x64.tar.gz
node-pre-gyp http 404 https://static.realm.io/node-pre-gyp/2.29.2/realm-v2.29.2-node-v72-darwin-x64.tar.gz
node-pre-gyp WARN Tried to download(404): https://static.realm.io/node-pre-gyp/2.29.2/realm-v2.29.2-node-v72-darwin-x64.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for realm@2.29.2 and node@12.6.0 (node-v72 ABI, unknown) (falling back to source compile with node-gyp) 
node-pre-gyp http 404 status code downloading tarball https://static.realm.io/node-pre-gyp/2.29.2/realm-v2.29.2-node-v72-darwin-x64.tar.gz 

And then plentiful gyp errors:

...

../src/node/node_types.hpp:52:42: error: no type named 'NamedPropertyGetterCallback' in namespace 'v8'; did you mean 'IndexPropertyGetterCallback'?
    using StringPropertyGetterCallback = v8::NamedPropertyGetterCallback;
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                         IndexPropertyGetterCallback
../src/node/node_types.hpp:50:11: note: 'IndexPropertyGetterCallback' declared here
    using IndexPropertyGetterCallback = Nan::IndexGetterCallback;
          ^
../src/node/node_types.hpp:53:42: error: no type named 'NamedPropertySetterCallback' in namespace 'v8'; did you mean 'IndexPropertySetterCallback'?
    using StringPropertySetterCallback = v8::NamedPropertySetterCallback;
                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                         IndexPropertySetterCallback
../src/node/node_types.hpp:51:11: note: 'IndexPropertySetterCallback' declared here
    using IndexPropertySetterCallback = Nan::IndexSetterCallback;
          ^
../src/node/node_types.hpp:54:50: error: no type named 'NamedPropertyEnumeratorCallback' in namespace 'v8'; did you mean 'IndexedPropertyEnumeratorCallback'?
    using StringPropertyEnumeratorCallback = v8::NamedPropertyEnumeratorCallback;
                                             ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                 IndexedPropertyEnumeratorCallback
/Users/thebigredgeek/Library/Caches/node-gyp/12.6.0/include/node/v8.h:5788:16: note: 'IndexedPropertyEnumeratorCallback' declared here
typedef void (*IndexedPropertyEnumeratorCallback)(
               ^
In file included from ../src/node/node_init.cpp:19:
In file included from ../src/node/node_init.hpp:21:
../src/node/node_string.hpp:51:32: error: too few arguments to function call, single argument 'isolate' was not specified
    m_str.resize(s->Utf8Length());
                 ~~~~~~~~~~~~~ ^
/Users/thebigredgeek/Library/Caches/node-gyp/12.6.0/include/node/v8.h:2678:3: note: 'Utf8Length' declared here
  int Utf8Length(Isolate* isolate) const;
  ^
In file included from ../src/node/node_init.cpp:19:
In file included from ../src/node/node_init.hpp:21:
../src/node/node_string.hpp:53:18: error: cannot initialize a parameter of type 'v8::Isolate *' with an rvalue of type 'std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::value_type *' (aka 'char *')
    s->WriteUtf8(&m_str[0], m_str.size(), 0, flags);
                 ^~~~~~~~~
/Users/thebigredgeek/Library/Caches/node-gyp/12.6.0/include/node/v8.h:2738:26: note: passing argument to parameter 'isolate' here
  int WriteUtf8(Isolate* isolate, char* buffer, int length = -1,
                         ^
In file included from ../src/node/node_init.cpp:19:
In file included from ../src/node/node_init.hpp:24:
../src/node/node_object.hpp:33:57: error: no type named 'ExternalOneByteStringResourceImpl' in namespace 'v8'; did you mean 'Nan::ExternalOneByteStringResource'?
        node_key = v8::String::NewExternal(isolate, new v8::ExternalOneByteStringResourceImpl(key.data(), key.size()));
                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                        Nan::ExternalOneByteStringResource
../../nan/nan.h:193:5: note: 'Nan::ExternalOneByteStringResource' declared here
    ExternalOneByteStringResource;
    ^
In file included from ../src/node/node_init.cpp:19:
In file included from ../src/node/node_init.hpp:24:
../src/node/node_object.hpp:33:61: error: allocating an object of abstract class type 'Nan::ExternalOneByteStringResource' (aka 'v8::String::ExternalOneByteStringResource')
        node_key = v8::String::NewExternal(isolate, new v8::ExternalOneByteStringResourceImpl(key.data(), key.size()));
                                                            ^
/Users/thebigredgeek/Library/Caches/node-gyp/12.6.0/include/node/v8.h:2854:25: note: unimplemented pure virtual method 'data' in 'ExternalOneByteStringResource'
    virtual const char* data() const = 0;
                        ^
/Users/thebigredgeek/Library/Caches/node-gyp/12.6.0/include/node/v8.h:2856:20: note: unimplemented pure virtual method 'length' in 'ExternalOneByteStringResource'
    virtual size_t length() const = 0;
                   ^
In file included from ../src/node/node_init.cpp:19:
In file included from ../src/node/node_init.hpp:24:
../src/node/node_object.hpp:108:40: error: no matching member function for call to 'ToString'
        names.push_back(array->Get(i)->ToString());
                        ~~~~~~~~~~~~~~~^~~~~~~~
/Users/thebigredgeek/Library/Caches/node-gyp/12.6.0/include/node/v8.h:2528:44: note: candidate function not viable: requires single argument 'context', but no arguments were provided
  V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
                                           ^
/Users/thebigredgeek/Library/Caches/node-gyp/12.6.0/include/node/v8.h:2544:31: note: candidate function not viable: requires single argument 'isolate', but no arguments were provided
                Local<String> ToString(Isolate* isolate) const);
                              ^
In file included from ../src/node/node_init.cpp:19:
In file included from ../src/node/node_init.hpp:25:
../src/node/node_function.hpp:41:19: error: no member named 'GetCallingContext' in 'v8::Isolate'; did you mean 'GetCurrentContext'?
    if (!isolate->GetCallingContext().IsEmpty()) {
                  ^~~~~~~~~~~~~~~~~
                  GetCurrentContext
/Users/thebigredgeek/Library/Caches/node-gyp/12.6.0/include/node/v8.h:7917:18: note: 'GetCurrentContext' declared here
  Local<Context> GetCurrentContext();
                 ^
In file included from ../src/node/node_init.cpp:19:
In file included from ../src/node/node_init.hpp:26:
../src/node/node_value.hpp:152:19: error: no matching member function for call to 'ToString'
    return value->ToString();
           ~~~~~~~^~~~~~~~
/Users/thebigredgeek/Library/Caches/node-gyp/12.6.0/include/node/v8.h:2528:44: note: candidate function not viable: requires single argument 'context', but no arguments were provided
  V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
                                           ^
/Users/thebigredgeek/Library/Caches/node-gyp/12.6.0/include/node/v8.h:2544:31: note: candidate function not viable: requires single argument 'isolate', but no arguments were provided
                Local<String> ToString(Isolate* isolate) const);
                              ^
In file included from ../src/node/node_init.cpp:19:
In file included from ../src/node/node_init.hpp:29:
../src/node/node_class.hpp:191:23: error: no member named 'SetNamedPropertyHandler' in 'v8::ObjectTemplate'; did you mean 'SetIndexedPropertyHandler'?
        instance_tpl->SetNamedPropertyHandler(string_accessor.getter ? string_accessor.getter : get_nonexistent_property, set_property, 0, 0, string_accessor.enumerator);
                      ^~~~~~~~~~~~~~~~~~~~~~~
                      SetIndexedPropertyHandler
/Users/thebigredgeek/Library/Caches/node-gyp/12.6.0/include/node/v8.h:6323:8: note: 'SetIndexedPropertyHandler' declared here
  void SetIndexedPropertyHandler(
       ^
In file included from ../src/node/node_init.cpp:19:
In file included from ../src/node/node_init.hpp:29:
In file included from ../src/node/node_class.hpp:23:
../src/js_class.hpp:92:17: error: no type named 'StringPropertyGetterCallback' in 'realm::node::Types'
    typename T::StringPropertyGetterCallback getter;
    ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/node/node_class.hpp:368:16: note: in instantiation of template class 'realm::js::StringPropertyType<realm::node::Types>' requested here
template<node::StringPropertyType::GetterType F>
               ^
In file included from ../src/node/node_init.cpp:19:
In file included from ../src/node/node_init.hpp:29:
In file included from ../src/node/node_class.hpp:23:
../src/js_class.hpp:93:17: error: no type named 'StringPropertySetterCallback' in 'realm::node::Types'
    typename T::StringPropertySetterCallback setter;
    ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../src/node/node_init.cpp:19:
In file included from ../src/node/node_init.hpp:29:
../src/node/node_class.hpp:373:10: error: called object type 'int' is not a function or function pointer
        F(isolate, info.This(), property, return_value);
        ~^
14 errors generated.

This should be fixed now as long as your package-lock.json does not try to install minipass@2.8.4: see https://github.com/mapbox/node-pre-gyp/issues/477#issuecomment-534630617

Looks like there was some dependency change that broke node-pre-gyp https://github.com/mapbox/node-pre-gyp/issues/477