Unable to install realm package through npm (realm/realm-js)

Hello,

I am unable to install the realm package.
I am using the docker image node:19.1.0 and when i do

npm install realm --save

I get the following answer :

npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher. You are currently using plaintext http to connect. Please visit the GitHub blog for more information: https://github.blog/2021-08-23-npm-registry-deprecating-tls-1-0-tls-1-1/
npm notice Beginning October 4, 2021, all connections to the npm registry - including for package installation - must use TLS 1.2 or higher. You are currently using plaintext http to connect. Please visit the GitHub blog for more information: https://github.blog/2021-08-23-npm-registry-deprecating-tls-1-0-tls-1-1/
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code 1
npm ERR! path /usr/src/app/node_modules/realm
npm ERR! command failed
npm ERR! command sh -c -- prebuild-install --tag-prefix= -r napi || cmake-js build
npm ERR! Not searching for unused variables given on the command line.
npm ERR! -- The C compiler identification is GNU 10.2.1
npm ERR! -- The CXX compiler identification is GNU 10.2.1
npm ERR! -- Detecting C compiler ABI info
npm ERR! -- Detecting C compiler ABI info - done
npm ERR! -- Check for working C compiler: /usr/bin/cc - skipped
npm ERR! -- Detecting C compile features
npm ERR! -- Detecting C compile features - done
npm ERR! -- Detecting CXX compiler ABI info
npm ERR! -- Detecting CXX compiler ABI info - done
npm ERR! -- Check for working CXX compiler: /usr/bin/c++ - skipped
npm ERR! -- Detecting CXX compile features
npm ERR! -- Detecting CXX compile features - done
npm ERR! -- Configuring incomplete, errors occurred!
npm ERR! See also "/usr/src/app/node_modules/realm/build/CMakeFiles/CMakeOutput.log".
npm ERR! prebuild-install warn install EACCES: permission denied, access '/root/.npm'
npm ERR! info TOOL Using Unix Makefiles generator.
npm ERR! info CMD CONFIGURE
npm ERR! info RUN [
npm ERR! info RUN   'cmake',
npm ERR! info RUN   '/usr/src/app/node_modules/realm',
npm ERR! info RUN   '--no-warn-unused-cli',
npm ERR! info RUN   '-G',
npm ERR! info RUN   'Unix Makefiles',
npm ERR! info RUN   '-DCMAKE_JS_VERSION=undefined',
npm ERR! info RUN   '-DCMAKE_BUILD_TYPE=Release',
npm ERR! info RUN   '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/usr/src/app/node_modules/realm/build/Release',
npm ERR! info RUN   '-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded$<$<CONFIG:Debug>:Debug>',
npm ERR! info RUN   '-DCMAKE_JS_INC=/usr/src/app/node_modules/node-api-headers/include;/usr/src/app/node_modules/node-addon-api',
npm ERR! info RUN   '-DCMAKE_JS_SRC=',
npm ERR! info RUN   '-DNODE_RUNTIME=node',
npm ERR! info RUN   '-DNODE_RUNTIMEVERSION=19.1.0',
npm ERR! info RUN   '-DNODE_ARCH=x64',
npm ERR! info RUN   '-DCMAKE_JS_LIB=',
npm ERR! info RUN   '-DCMAKE_CXX_FLAGS=-DBUILDING_NODE_EXTENSION'
npm ERR! info RUN ]
npm ERR! CMake Error at CMakeLists.txt:96 (add_subdirectory):
npm ERR!   add_subdirectory given source "vendor/realm-core" which is not an existing
npm ERR!   directory.
npm ERR! 
npm ERR! 
npm ERR! CMake Error at CMakeLists.txt:99 (add_subdirectory):
npm ERR!   add_subdirectory given source "src" which is not an existing directory.
npm ERR! 
npm ERR! 
npm ERR! ERR! OMG Process terminated: 1

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2023-01-07T00_36_52_049Z-debug-0.log

it seems like the realm/realm-js package has a file CMakeLists.txt containing the following line that cause my error :

    add_subdirectory(vendor/realm-core EXCLUDE_FROM_ALL)
endif()

add_subdirectory(src)

But i dont know what to do with it.

Does someone already got this error? have you been able to fix it?

Did you address the above message?

It also seems your libraries and npm are out of date.

Thank you for your answer.
I saw those notice but did not try anything about it. I should :smiley:

Meanwhile i was trying with yarn

yarn add realm

but there is still an issue.
according to the github issue node 19 hangs when installing Realm · Issue #5136 · realm/realm-js · GitHub realm hangs when trying to install on 19.1.0
i had to downgrade to node:18.2 and it works


So for me the working solution was using a docker image

FROM node:18.2.0

and using yarn doing:

yarn add realm

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.