Realm-js: error when install Realm on window

Created on 13 Jan 2017  路  6Comments  路  Source: realm/realm-js

Hi all,

I have try to install Realm on window for new project react-native, but it fall

step I did:

create new react-native project
react-native init TestRealm
cd TestRealm

And then install Realm

npm install --save realm

And link

react-native link realm

Then run

react-native run-android

but it have error

C:\Users\keyyu\Atom\Workspace\TestRealm>react-native run-android
Starting JS server...
'adb' is not recognized as an internal or external command,
operable program or batch file.
Building and installing the app on the device (cd android && gradlew.bat installDebug)...

FAILURE: Build failed with an exception.

* Where:
Build file 'C:\Users\keyyu\Atom\Workspace\TestRealm\node_modules\realm\android\build.gradle' line: 71

* What went wrong:
A problem occurred evaluating project ':realm'.
> Cannot run program "npm" (in directory "C:\Users\keyyu\Atom\Workspace\TestRealm\node_modules\realm\android"): CreateProcess error=2, The system cannot find the file specified

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 22.896 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html

(node:10272) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: Cannot read property 'message' of undefined

I did step by step like https://realm.io/docs/react-native/latest/.

my enviroment

"node": v6.9.2
"npm": v3.10.9
"react": "15.4.2",
"react-native": "0.40.0",
"realm": "^0.15.4"

Please help.

Thank you!

T-Bug

Most helpful comment

Having same issue in 1.0.2. Simply commenting out that line seems to be fixing it so far at least....

All 6 comments

Hi @keyyuki did you install the Android dependencies like it says in https://facebook.github.io/react-native/docs/getting-started.html ?

Hi @kristiandupont,

I did. In fact, I tried to install new react-native without realm, it work. Any project I have done work too, but when I try to install realm to a new react-native project, it still error.
Now I'm trying to install new react-native project with realm version 0.14.3 as suggest of @EricCarrGH in https://github.com/realm/realm-js/issues/674 and will report you as soon as possibale

Thanks.

Hi @kristiandupont,

It work, when I change version realm to 0.14.3, it work.

There is content of package.json file, hope it help you.

{
  "name": "CheckVerision",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "react": "15.4.2",
    "react-native": "^0.39.2",
    "react-native-menu": "^0.20.2",
    "realm": "^0.14.3"
  },
  "devDependencies": {
    "babel-jest": "18.0.0",
    "babel-preset-react-native": "1.9.1",
    "jest": "18.1.0",
    "react-test-renderer": "15.4.2"
  },
  "jest": {
    "preset": "react-native"
  }
}

"node": v6.9.2
"npm": v3.10.9

Ok, I'll investigate this when I get some time. Thank you for reporting.

I did run into same issue, but after commenting out the version in ..\node_modules\realm\android\build.gradle another error popped up.

FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':realm:compileReleaseJavaWithJavac'.
> Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_121 contains a valid JDK installation.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

But only when trying to run via console. Seems to work fine with commented out version while building via android studio.

Having same issue in 1.0.2. Simply commenting out that line seems to be fixing it so far at least....

Was this page helpful?
0 / 5 - 0 ratings