realm / realm-js

Realm is a mobile database: an alternative to SQLite & key-value stores
https://realm.io
Apache License 2.0
5.74k stars 565 forks source link

Cannot install v11.0.0 RN #5045

Closed adlambel closed 1 year ago

adlambel commented 1 year ago

How frequently does the bug occur?

All the time

Description

Hello,

I wanted to try the new v11 version of realm in a react-native project but I can't install it via npm. I created a new react-native project (with RN 0.70.4) with the official react-native template (Typescript).

Right after the init of the project, I tried to npm install realm but always have the same error : sh: cmake-js: command not found

I tried different versions of node (multiple 14.X and 16.X) to install

Do you have any ideas on how to fix this problem ?

Thanks !

Stacktrace & log output

npm ERR! code 127
npm ERR! command failed
npm ERR! command sh -c -- prebuild-install --tag-prefix= -r napi || cmake-js build
npm ERR! prebuild-install warn install EACCES: permission denied, open '/Users/XXX/.npm/_prebuilds/deaa39-realm-v11.0.0-napi-v5-darwin-x64.tar.gz.44980-adf399f9b0396.tmp'
npm ERR! sh: cmake-js: command not found

Can you reproduce the bug?

Yes, always

Reproduction Steps

Init a new react-native project with the react-native typescript official template :

npx react-native init AwesomeRealmProject --template react-native-template-typescript

npm i

npm install realm

Version

v11.0.0

What SDK flavour are you using?

Local Database only

Are you using encryption?

No, not using encryption

Platform OS and version(s)

MacOS Monterey 12.6, Intel (not M1)

Build environment

Which debugger for React Native: ..

Cocoapods version

No response

rf1804 commented 1 year ago

+1

Maybe this could be an issue, difference i found in v10.23.0 and v11.0.0 is GCDWebServer is not there in v11.0.0

kneth commented 1 year ago

So far I haven't able to able to reproduce it - using MacOS 12.6 (M1) and node 16.17.0.

Can you download the binaries manually:

 curl -O https://static.realm.io/realm-js-prebuilds/11.0.0/realm-v11.0.0-napi-v5-darwin-x64.tar.gz

The tar.gz file is about 3 MB. If you can, please try to install Realm again to see if was a transient issue with our servers or the connection.

adlambel commented 1 year ago

Hi,

Thanks for the reply ! I successfully downloaded the binaries with curl but still can't install Realm via npm.

Did I misunderstood something ? Was the curl request just to make sure i can DL it or was I supposed to use it ?

I also tried with node 16.17.0 and still facing :

npm ERR! code 127 npm ERR! path /Users/adrienlambel/WebstormProjects/app/talesupreader/node_modules/realm npm ERR! command failed npm ERR! command sh /var/folders/63/vb_j28752gg3k2tjxxbq05mr0000gn/T/install-f20768bf.sh npm ERR! prebuild-install warn install EACCES: permission denied, open '/Users/adrienlambel/.npm/_prebuilds/deaa39-realm-v11.0.0-napi-v5-darwin-x64.tar.gz.48565-6715cf1039661.tmp' npm ERR! /var/folders/63/vb_j28752gg3k2tjxxbq05mr0000gn/T/install-f20768bf.sh: line 1: cmake-js: command not found

kneth commented 1 year ago

Thank for the update. I ask about the manual download to verify that nothing between you and our server is blocking you.

The error message sh: cmake-js: command not found indicates that you cannot download binaries, and npm tries to build from source (and we use cmake-js for that).

I don't understand why you have a permission error but as a work-around you can try to add --unsafe-perm when you install Realm: npm install --unsafe-perm realm

atropos0902 commented 1 year ago

Thank for the update. I ask about the manual download to verify that nothing between you and our server is blocking you.

The error message sh: cmake-js: command not found indicates that you cannot download binaries, and npm tries to build from source (and we use cmake-js for that).

I don't understand why you have a permission error but as a work-around you can try to add --unsafe-perm when you install Realm: npm install --unsafe-perm realm

I have similar issue.

Exit code: 127
Command: prebuild-install --tag-prefix= -r napi || cmake-js build
Arguments: 
Directory: /Volumes/Code/envas/node_modules/realm
Output:
prebuild-install warn install premature close
/bin/sh: cmake-js: command not found
kneth commented 1 year ago

@atropos0902 I wonder if you are behind a proxy server and needs to set HTTP_PROXY or HTTPS_PROXY.

atropos0902 commented 1 year ago

@atropos0902 I wonder if you are behind a proxy server and needs to set HTTP_PROXY or HTTPS_PROXY.

I was behind the proxy and when I disabled the proxy, it worked. Thank you!

kneth commented 1 year ago

@atropos0902 I closing the issue. I am a bit surprise to see that prebuild-install doesn't handle proxies well.