Closed lucasvog closed 6 years ago
Paste your .babelrc
file
It is
{
"presets": ["module:metro-react-native-babel-preset"],
"plugins": [
"@nozbe/watermelondb/babel/cjs",
["@babel/plugin-proposal-decorators", { "legacy": true }]
]
}
as it is react native 0.57.0
I just checked and the same error occurs on react native 0.56.0, with .babelrc:
{
"presets": ["react-native"],
"plugins": [
"@nozbe/watermelondb/babel/cjs",
["@babel/plugin-proposal-decorators", { "legacy": true }]
]
}
and
"@nozbe/watermelondb": "^0.6.1",
"react": "16.4.1",
"react-native": "0.56.0"
"@babel/plugin-proposal-decorators": "^7.1.0",
"babel-jest": "23.6.0",
"babel-preset-react-native": "^5",
"jest": "23.6.0",
"react-test-renderer": "16.4.1"
After installing the database, a error showed up saying
Unable to resolve module utils/commonfrom /Users/ .. /node_modules/@nozbe/watermelondb/adapters/sqlite/index.js: Module utils/commondoes not exist in the Haste module map
this doesn't look right. Your app shouldn't be importing /node_modules/@nozbe/watermelondb/adapters/sqlite/index.js, but rather ā¦/watermelondb/cjs/adapters/sqlite/index.js.
So it looks like Metro is not picking up changes from your babel config (which rewrites imports).
Have you tried killing the packager, removing all Metro caches, and restarting packager without cache? (look up RN docs for this)
After inspecting the dependencies it looked like that the folder was located into the watermelondb/src/ folder. After copying the adapter folder to watermelondb/adapters, a new error occured, stating
No, that's not right. Don't do this, it will break the build.
Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/test4.app/Info.plist Print: Entry, ":CFBundleIdentifier", Does Not Exist
yep, that's a consequence of JS build breaking
I resetted everything. At first, the app launched, however this error showed up:
The following commands produced analyzer issues:
Analyze /Users/.../node_modules/react-native/React/Base/RCTModuleMethod.mm normal x86_64
(1 command with analyzer issues)
The following build commands failed:
Ld /Users/.../ios/build/Build/Products/Debug-iphonesimulator/test4.app/test4 normal x86_64
(1 failure)
An error was encountered processing the command (domain=IXUserPresentableErrorDomain, code=1):
This app could not be installed at this time.
Failed to chmod /Users/.../Library/Developer/CoreSimulator/Devices/FD47515D-5763-478E-9B81-02C40EB2298C/data/Bundle/Application/2EECD866-36CB-4931-8EC2-553CD9261616/test4.app/test4 : No such file or directory
Failed to chmod /Users/.../Library/Developer/CoreSimulator/Devices/FD47515D-5763-478E-9B81-02C40EB2298C/data/Bundle/Application/2EECD866-36CB-4931-8EC2-553CD9261616/test4.app/test4 : No such file or directory
Underlying error (domain=MIInstallerErrorDomain, code=4):
Failed to chmod /Users/.../Library/Developer/CoreSimulator/Devices/FD47515D-5763-478E-9B81-02C40EB2298C/data/Bundle/Application/2EECD866-36CB-4931-8EC2-553CD9261616/test4.app/test4 : No such file or directory
org.reactjs.native.example.test4: 12574
.String, resolve: (Any?) -> (), reject: (Swift.String?, Swift.String?, Swift.Error?) -> ()) -> () in libWatermelonDB.a(DatabaseBridge-21ff1e247ba56f1497b19088f1086744c4f19d663f5f6a5d5080c7fc10c9cd18.o)
...
"_swift_slowDealloc", referenced from:
___swift_deallocate_boxed_opaque_existential_0 in libWatermelonDB.a(DatabaseBridge-21ff1e247ba56f1497b19088f1086744c4f19d663f5f6a5d5080c7fc10c9cd18.o)
"_swift_unexpectedError", referenced from:
WatermelonDB.Database.init(Swift.String?) -> WatermelonDB.Database in libWatermelonDB.a(Database.o)
WatermelonDB.Database.userVersion.getter : Swift.Int in libWatermelonDB.a(Database.o)
WatermelonDB.Database.userVersion.setter : Swift.Int in libWatermelonDB.a(Database.o)
"_swift_unknownRelease", referenced from:
outlined consume of Swift._VariantDictionaryBuffer<A, B><A, B where A: Swift.Hashable> in libWatermelonDB.a(DatabaseBridge-21ff1e247ba56f1497b19088f1086744c4f19d663f5f6a5d5080c7fc10c9cd18.o)
reabstraction thunk helper from @callee_unowned @convention(block) (@unowned Swift.AnyObject?) -> () to @escaping @callee_guaranteed (@in_guaranteed Any?) -> () in libWatermelonDB.a(DatabaseBridge-21ff1e247ba56f1497b19088f1086744c4f19d663f5f6a5d5080c7fc10c9cd18.o)
generic specialization <preserving fragile attribute, (extension in Dispatch):__C.OS_dispatch_queue.Attributes> of Swift.Array._getElement(_: Swift.Int, wasNativeTypeChecked: Swift.Bool, matchingSubscriptCheck: Swift._DependenceToken) -> A in libWatermelonDB.a(DatabaseBridge-21ff1e247ba56f1497b19088f1086744c4f19d663f5f6a5d5080c7fc10c9cd18.o)
generic specialization <preserving fragile attribute, (extension in Dispatch):__C.OS_dispatch_queue.Attributes> of Swift._ArrayBuffer._getElementSlowPath(Swift.Int) -> Swift.AnyObject in libWatermelonDB.a(DatabaseBridge-21ff1e247ba56f1497b19088f1086744c4f19d663f5f6a5d5080c7fc10c9cd18.o)
outlined consume of Swift._VariantSetBuffer<A><A where A: Swift.Hashable> in libWatermelonDB.a(DatabaseDriver.o)
"_swift_unknownRetain", referenced from:
outlined copy of Swift._VariantDictionaryBuffer<A, B><A,B where A: Swift.Hashable> in libWatermelonDB.a(DatabaseBridge-21ff1e247ba56f1497b19088f1086744c4f19d663f5f6a5d5080c7fc10c9cd18.o)
generic specialization <preserving fragile attribute, (extension in Dispatch):__C.OS_dispatch_queue.Attributes> of Swift._ArrayBuffer._getElementSlowPath(Swift.Int) -> Swift.AnyObject in libWatermelonDB.a(DatabaseBridge-21ff1e247ba56f1497b19088f1086744c4f19d663f5f6a5d5080c7fc10c9cd18.o)
outlined copy of Swift._VariantSetBuffer<A><A where A: Swift.Hashable> in libWatermelonDB.a(DatabaseDriver.o)
"_swift_willThrow", referenced from:
WatermelonDB.DatabaseBridge.(withDriver in _1C6FA28906863A6C0CE9AB47D1C939AA)(_: __C.NSNumber, _: (Any?) -> (), _: (Swift.String?, Swift.String?, Swift.Error?) -> (), functionName: Swift.String, action: (WatermelonDB.DatabaseDriver) throws -> Any) -> () in libWatermelonDB.a(DatabaseBridge-21ff1e247ba56f1497b19088f1086744c4f19d663f5f6a5d5080c7fc10c9cd18.o)
closure #1 ([Any]) throws -> WatermelonDB.DatabaseDriver.Operation in closure #1 (WatermelonDB.DatabaseDriver) throws -> Any in WatermelonDB.DatabaseBridge.batch(tag: __C.NSNumber, operations: [[Any]], resolve: (Any?) -> (), reject: (Swift.String?, Swift.String?, Swift.Error?) -> ()) -> () in libWatermelonDB.a(DatabaseBridge-21ff1e247ba56f1497b19088f1086744c4f19d663f5f6a5d5080c7fc10c9cd18.o)
reabstraction thunk helper from @callee_guaranteed (@guaranteed [Any]) -> (@owned WatermelonDB.DatabaseDriver.Operation, @error @owned Swift.Error) to @escaping @callee_guaranteed (@in_guaranteed [Any]) -> (@out WatermelonDB.DatabaseDriver.Operation, @error @owned Swift.Error) in libWatermelonDB.a(DatabaseBridge-21ff1e247ba56f1497b19088f1086744c4f19d663f5f6a5d5080c7fc10c9cd18.o)
reabstraction thunk helper from @callee_guaranteed (@guaranteed __C.FMResultSet) -> (@out Any, @error @owned Swift.Error) to @escaping @callee_guaranteed (@in_guaranteed __C.FMResultSet) -> (@out Any, @error @owned Swift.Error) in libWatermelonDB.a(DatabaseDriver.o)
reabstraction thunk helper from @callee_guaranteed (@guaranteed __C.FMResultSet) -> (@owned Swift.String, @error @ownedSwift.Error) to @escaping @callee_guaranteed (@in_guaranteed __C.FMResultSet) -> (@out Swift.String, @error @owned Swift.Error) in libWatermelonDB.a(DatabaseDriver.o)
reabstraction thunk helper from @callee_guaranteed (@guaranteed Swift.String) -> (@owned Swift.String, @error @owned Swift.Error) to @escaping @callee_guaranteed (@in_guaranteed Swift.String) -> (@out Swift.String, @error @owned Swift.Error) in libWatermelonDB.a(DatabaseDriver.o)
WatermelonDB.Database.inTransaction(() throws -> ()) throws -> () in libWatermelonDB.a(Database.o)
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Installing build/Build/Products/Debug-iphonesimulator/test4.app
Launching org.reactjs.native.example.test4
As it looked like it started, however database transactions where not possible. I also started from scratch (again) and the same error occured. After trial and error the :CFBundleIdentifier
- Error showed up again.
Now to the strange part. I started the example app provided in this repo, and it started without an error. Then I transfered my schema and model over. And it worked flawlessly, no error, no problem, transactions are also working. I then moved big parts of my code over and it just works.
and th .babelrc-file is the same:
{
"presets": ["module:metro-react-native-babel-preset"],
"plugins": [
"@nozbe/watermelondb/babel/cjs",
["@babel/plugin-proposal-decorators", { "legacy": true }]
]
}
This is so strange.
An error was encountered processing the command (domain=IXUserPresentableErrorDomain, code=1):
This app could not be installed at this time.
Failed to chmod /Users/.../Library/Developer/CoreSimulator/Devices/FD47515D-5763-478E-9B81-02C40EB2298C/data/Bundle/Application/2EECD866-36CB-4931-8EC2-553CD9261616/test4.app/test4 : No such file or directory
Failed to chmod /Users/.../Library/Developer/CoreSimulator/Devices/FD47515D-5763-478E-9B81-02C40EB2298C/data/Bundle/Application/2EECD866-36CB-4931-8EC2-553CD9261616/test4.app/test4 : No such file or directory
Underlying error (domain=MIInstallerErrorDomain, code=4):
Failed to chmod /Users/.../Library/Developer/CoreSimulator/Devices/FD47515D-5763-478E-9B81-02C40EB2298C/data/Bundle/Application/2EECD866-36CB-4931-8EC2-553CD9261616/test4.app/test4 : No such file or directory
org.reactjs.native.example.test4: 12574
.String, resolve: (Any?) -> (), reject: (Swift.String?, Swift.String?, Swift.Error?) -> ()) -> () in libWatermelonDB.a(DatabaseBridge-21ff1e247ba56f1497b19088f1086744c4f19d663f5f6a5d5080c7fc10c9cd18.o)
...
"_swift_slowDealloc", referenced from:
___swift_deallocate_boxed_opaque_existential_0 in libWatermelonDB.a(DatabaseBridge-21ff1e247ba56f1497b19088f1086744c4f19d663f5f6a5d5080c7fc10c9cd18.o)
"_swift_unexpectedError", referenced from:
WatermelonDB.Database.init(Swift.String?) -> WatermelonDB.Database in libWatermelonDB.a(Database.o)
WatermelonDB.Database.userVersion.getter : Swift.Int in libWatermelonDB.a(Database.o)
WatermelonDB.Database.userVersion.setter : Swift.Int in libWatermelonDB.a(Database.o)
"_swift_unknownRelease", referenced from:
outlined consume of Swift._VariantDictionaryBuffer<A, B><A, B where A: Swift.Hashable> in libWatermelonDB.a(DatabaseBridge-21ff1e247ba56f1497b19088f1086744c4f19d663f5f6a5d5080c7fc10c9cd18.o)
reabstraction thunk helper from @callee_unowned @convention(block) (@unowned Swift.AnyObject?) -> () to @escaping @callee_guaranteed (@in_guaranteed Any?) -> () in libWatermelonDB.a(DatabaseBridge-21ff1e247ba56f1497b19088f1086744c4f19d663f5f6a5d5080c7fc10c9cd18.o)
generic specialization <preserving fragile attribute, (extension in Dispatch):__C.OS_dispatch_queue.Attributes> of Swift.Array._getElement(_: Swift.Int, wasNativeTypeChecked: Swift.Bool, matchingSubscriptCheck: Swift._DependenceToken) -> A in libWatermelonDB.a(DatabaseBridge-21ff1e247ba56f1497b19088f1086744c4f19d663f5f6a5d5080c7fc10c9cd18.o)
generic specialization <preserving fragile attribute, (extension in Dispatch):__C.OS_dispatch_queue.Attributes> of Swift._ArrayBuffer._getElementSlowPath(Swift.Int) -> Swift.AnyObject in libWatermelonDB.a(DatabaseBridge-21ff1e247ba56f1497b19088f1086744c4f19d663f5f6a5d5080c7fc10c9cd18.o)
outlined consume of Swift._VariantSetBuffer<A><A where A: Swift.Hashable> in libWatermelonDB.a(DatabaseDriver.o)
"_swift_unknownRetain", referenced from:
outlined copy of Swift._VariantDictionaryBuffer<A, B><A,B where A: Swift.Hashable> in libWatermelonDB.a(DatabaseBridge-21ff1e247ba56f1497b19088f1086744c4f19d663f5f6a5d5080c7fc10c9cd18.o)
generic specialization <preserving fragile attribute, (extension in Dispatch):__C.OS_dispatch_queue.Attributes> of Swift._ArrayBuffer._getElementSlowPath(Swift.Int) -> Swift.AnyObject in libWatermelonDB.a(DatabaseBridge-21ff1e247ba56f1497b19088f1086744c4f19d663f5f6a5d5080c7fc10c9cd18.o)
outlined copy of Swift._VariantSetBuffer<A><A where A: Swift.Hashable> in libWatermelonDB.a(DatabaseDriver.o)
"_swift_willThrow", referenced from:
WatermelonDB.DatabaseBridge.(withDriver in _1C6FA28906863A6C0CE9AB47D1C939AA)(_: __C.NSNumber, _: (Any?) -> (), _: (Swift.String?, Swift.String?, Swift.Error?) -> (), functionName: Swift.String, action: (WatermelonDB.DatabaseDriver) throws -> Any) -> () in libWatermelonDB.a(DatabaseBridge-21ff1e247ba56f1497b19088f1086744c4f19d663f5f6a5d5080c7fc10c9cd18.o)
closure #1 ([Any]) throws -> WatermelonDB.DatabaseDriver.Operation in closure #1 (WatermelonDB.DatabaseDriver) throws -> Any in WatermelonDB.DatabaseBridge.batch(tag: __C.NSNumber, operations: [[Any]], resolve: (Any?) -> (), reject: (Swift.String?, Swift.String?, Swift.Error?) -> ()) -> () in libWatermelonDB.a(DatabaseBridge-21ff1e247ba56f1497b19088f1086744c4f19d663f5f6a5d5080c7fc10c9cd18.o)
reabstraction thunk helper from @callee_guaranteed (@guaranteed [Any]) -> (@owned WatermelonDB.DatabaseDriver.Operation, @error @owned Swift.Error) to @escaping @callee_guaranteed (@in_guaranteed [Any]) -> (@out WatermelonDB.DatabaseDriver.Operation, @error @owned Swift.Error) in libWatermelonDB.a(DatabaseBridge-21ff1e247ba56f1497b19088f1086744c4f19d663f5f6a5d5080c7fc10c9cd18.o)
reabstraction thunk helper from @callee_guaranteed (@guaranteed __C.FMResultSet) -> (@out Any, @error @owned Swift.Error) to @escaping @callee_guaranteed (@in_guaranteed __C.FMResultSet) -> (@out Any, @error @owned Swift.Error) in libWatermelonDB.a(DatabaseDriver.o)
reabstraction thunk helper from @callee_guaranteed (@guaranteed __C.FMResultSet) -> (@owned Swift.String, @error @ownedSwift.Error) to @escaping @callee_guaranteed (@in_guaranteed __C.FMResultSet) -> (@out Swift.String, @error @owned Swift.Error) in libWatermelonDB.a(DatabaseDriver.o)
reabstraction thunk helper from @callee_guaranteed (@guaranteed Swift.String) -> (@owned Swift.String, @error @owned Swift.Error) to @escaping @callee_guaranteed (@in_guaranteed Swift.String) -> (@out Swift.String, @error @owned Swift.Error) in libWatermelonDB.a(DatabaseDriver.o)
WatermelonDB.Database.inTransaction(() throws -> ()) throws -> () in libWatermelonDB.a(Database.o)
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Those errors indicate missing Swift. See point 3 here: https://github.com/Nozbe/WatermelonDB/blob/master/docs/Installation.md#ios-react-native
Let me know if this fixes it
Aw shoot the last one I could have easily found out myself.... Sorry. It now works, thanks a lot!
@lucasvog Phew. Glad it works. I know the Installation guide is pretty long and complicated. We're working on simplifying it.
Is there something we could do to improve the Install guide, a reason why you missed this step? If so, please hit the edit button on the guide and send a pull request with an improvement!
I am struggling with the same error.
Looking for JS files in
/Users/bsr/myapp
Loading dependency graph, done.
BUNDLE [android, dev] ../../index.js āāāāāāāāāāāāāāāā 0.0% (0/1)::ffff:127.0.0.1 - - [04/Oct/2018:02:03:43 +0000] "GET /index.delta?platform=android&dev=true&minify=false HTTP/1.1" 500 - "-" "okhttp/3.10.0"
error: bundling failed: Error: Unable to resolve module `@nozbe/watermelondb/adapters/sqlite` from `/Users/bsr/myapp/index.js`: Module `@nozbe/watermelondb/adapters/sqlite` does not exist in the Haste module map
This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:
1. Clear watchman watches: `watchman watch-del-all`.
2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.
4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`.
at ModuleResolver.resolveDependency (/Users/bsr/myapp/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:209:1301)
at ResolutionRequest.resolveDependency (/Users/bsr/myapp/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:83:16)
at DependencyGraph.resolveDependency (/Users/bsr/myapp/node_modules/metro/src/node-haste/DependencyGraph.js:238:485)
at Object.resolve (/Users/bsr/myapp/node_modules/metro/src/lib/transformHelpers.js:180:25)
at dependencies.map.result (/Users/bsr/myapp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:311:29)
at Array.map (<anonymous>)
at resolveDependencies (/Users/bsr/myapp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:307:16)
at /Users/bsr/myapp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:164:33
at Generator.next (<anonymous>)
at step (/Users/bsr/myapp/node_modules/metro/src/DeltaBundler/traverseDependencies.js:266:307)
BUNDLE [android, dev] ../../index.js āāāāāāāāāāāāāāāā 0.0% (0/1), failed.
I did clear all cache, close launcher, delete node_modules and recreated emulator image etc.
$ watchman watch-del-all && rm -rf /tmp/metro-bundler-cache-* && rm -rf /tmp/haste-map-react-native-packager-*
rm -rf node_modules
yarn
Still same error. Relevant changes as part of this installation
babel.rc
{
"presets": ["module:metro-react-native-babel-preset"],
"plugins": [
"@nozbe/watermelondb/babel/cjs",
["@babel/plugin-proposal-decorators", { "legacy": true }]
]
}
index.js
import { Database } from '@nozbe/watermelondb';
import SQLiteAdapter from '@nozbe/watermelondb/adapters/sqlite';
...
const adapter = new SQLiteAdapter({
....
package.json
"dependencies": {
"@nozbe/watermelondb": "^0.6.1",
....
"devDependencies": {
"@babel/plugin-proposal-decorators": "^7.1.2",
..
build.gradle
buildscript {
ext.kotlin_version = '1.2.61'
...
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
..
settings.gradle
...
include ':watermelondb'
project(':watermelondb').projectDir =
new File(rootProject.projectDir, '../node_modules/@nozbe/watermelondb/native/android')
...
app/build.gradle
apply plugin: 'kotlin-android'
...
dependencies {
implementation project(':watermelondb')
MainApplication.java
import com.nozbe.watermelondb.WatermelonDBPackage;
...
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new WatermelonDBPackage()
);
}
please let me know if you could see any mistake in my setup
ok, I saw you removed @nozbe/watermelondb/babel/cjs
, so updating to @next
solved the issue
yarn add @nozbe/watermelondb@next
thanks
@bsr203 that's strange, upgrading to @next
shouldn't be necessary, but as I understand the issue is fixed?
ya. it went well with @next branch. thanks again for taking the time to respond. Cheers.
OK, closing this now.
@radex sorry. I was too early to say everything went well. I got upto missing Symbol
and as advided tried to use with jsc. Now getting build failure.
$ yarn android
yarn run v1.10.1
$ export JAVA_HOME=`/usr/libexec/java_home -v 1.8 ANDROID_HOME=/Users/bsr/Library/Android/sdk` && react-native run-android
Starting JS server...
Building and installing the app on the device (cd android && ./gradlew installDebug)...
> Configure project :watermelondb
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
e: /Users/bsr/myApp/node_modules/@nozbe/watermelondb/native/android/src/main/java/com/nozbe/watermelondb/DatabaseBridge.kt: (66, 57): Unresolved reference: toArrayList
e: /Users/bsr/myApp/node_modules/@nozbe/watermelondb/native/android/src/main/java/com/nozbe/watermelondb/DatabaseBridge.kt: (107, 62): Unresolved reference: toArrayList
e: /Users/bsr/myApp/node_modules/@nozbe/watermelondb/native/android/src/main/java/com/nozbe/watermelondb/DatabaseBridge.kt: (113, 62): Unresolved reference: toArrayList
e: /Users/bsr/myApp/node_modules/@nozbe/watermelondb/native/android/src/main/java/com/nozbe/watermelondb/WatermelonDBPackage.kt: (15, 9): 'createJSModules' hides member of supertype 'ReactPackage' and needs 'override' modifier
FAILURE: Build failed with an exception.
please advise. thanks.
@radex sorry. I made a configuration mistake. I thought you may replace react-native/android"
, with jsc-android/dist"
, but we need both like.
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
url "$rootDir/../node_modules/jsc-android/dist"
}
google()
}
}
thanks again
After installing the database, a error showed up saying
After inspecting the dependencies it looked like that the folder was located into the watermelondb/src/ folder. After copying the adapter folder to watermelondb/adapters, a new error occured, stating
This breaks the app so hard that it will not build even after undoing everything related to WatermelonDB, removing the "build"-Folder, and so on.
I am using