Realm-js: How to install realm

Created on 4 Jun 2019  路  13Comments  路  Source: realm/realm-js

Hi How Can I install the Realm ?

I mean which version of node should be used to install it ?

I have tried almost all version but seems very difficult to get it work.

Expected Results

I expect at least to get npm install done it is not working

Actual Results

-napi_build_version=0" "--node_napi_label=node-v57"
gyp ERR! cwd /Users/pritambolenwar/Repository/PROJECTS/ModemConfigurator/node_modules/realm
gyp ERR! node -v v8.16.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/pritambolenwar/Repository/PROJECTS/ModemConfigurator/node_modules/realm/compiled/node-v57_darwin_x64/realm.node --module_name=realm --module_path=/Users/pritambolenwar/Repository/PROJECTS/ModemConfigurator/node_modules/realm/compiled/node-v57_darwin_x64 --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v57' (1)
node-pre-gyp ERR! stack at ChildProcess. (/Users/pritambolenwar/Repository/PROJECTS/ModemConfigurator/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:126:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:214:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:915:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
node-pre-gyp ERR! System Darwin 18.2.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/pritambolenwar/Repository/PROJECTS/ModemConfigurator/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/pritambolenwar/Repository/PROJECTS/ModemConfigurator/node_modules/realm
node-pre-gyp ERR! node -v v8.16.0
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --module=/Users/pritambolenwar/Repository/PROJECTS/ModemConfigurator/node_modules/realm/compiled/node-v57_darwin_x64/realm.node --module_name=realm --module_path=/Users/pritambolenwar/Repository/PROJECTS/ModemConfigurator/node_modules/realm/compiled/node-v57_darwin_x64 --napi_version=4 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v57' (1)
npm WARN [email protected] requires a peer of [email protected] but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: node install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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:

Version of Realm and Tooling

  • Realm JS SDK Version: 2.28.0
  • Node or React Native: 0.59
  • Client OS & Version: Mojave 10.14.3
  • Which debugger for React Native: Yes
O-Community Reproduction-Required T-Help

Most helpful comment

Prerequisite Node 10 should be noted in the getting started documentation for React Native.
It is on the Node.js tab but not React Native. Will save a lot of people some time.

All 13 comments

@pritasam Can you please provide the exact steps you take to reproduce this from scratch?
Do you also have this problem if you start from scratch with a "hello world" kind of app?

I am also getting this error after updating my realm version from ^2.12.0 to ^2.28.1.

OS: macOS 10.14.4

$ node -v
v11.12.0
$  npm -v
6.7.0

Error:

../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/mntn/.node-gyp/11.12.0/include/node/v8.h:5646: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: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/mntn/.node-gyp/11.12.0/include/node/v8.h:7730: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: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/mntn/.node-gyp/11.12.0/include/node/v8.h:6178: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);
        ~^
8 errors generated.
make: *** [Release/obj.target/realm/src/node/node_init.o] Error 1

What version of node is being used in Realm?

You need node 10.

You need node 10.

Yep. I already figured it out, and linked it to a previous issue. This should be closed.

I opted for Firebase, afaik I don't know if they have localStorage, but I wanted to use hooks, and primarily get performance benefits on Android with the previous react native update.

Prerequisite Node 10 should be noted in the getting started documentation for React Native.
It is on the Node.js tab but not React Native. Will save a lot of people some time.

I often use Node v8.11 with no problems. I believe RN has a requirement of Node v8.3 or later.

PLEEEEASE add the node version to the README.md - I had LTS version (12) installed but you need 10. just mentioning "node v8.3 or later" includes v12 for me...

@nhebling Only documented at https://realm.io/docs/javascript/latest so I'll add it to README.md.

Hi folks I opted to use Node Version Manager to control which version of Node I could use in my Windows environment:

https://github.com/coreybutler/nvm-windows/releases

I installed NVM from the setup release at the above github site.
Opened up Command prompt with administrator rights
Browse to the project directory where you want to install realm.
Type: nvm list
This will display the versions of node.js you have installed. If you have version 10 listed simply type:
nvm use 10.0.0

Otherwise type to first install the correct version of node.js:

nvm install 10.0.0

Finally type: nvm use 10.0.0 to switch to the correct version and then continue to install realm as per their instructions.

@vurso Thank you for explaining how to use nvm on Windows. For our internal testing, we use nodist. You are welcome to add it to our README.md as a pull request.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

timanglade picture timanglade  路  3Comments

texas697 picture texas697  路  3Comments

matt2legit picture matt2legit  路  3Comments

ashah888 picture ashah888  路  3Comments

camslaz picture camslaz  路  4Comments