Closed iwater closed 7 years ago
Is this a yarn-specific problem or does it also not run with npm? I know it's unlikely that yarn is the evil, but could you test it for me?
npm got this error
@iwater can you retry this with the latest version 4.0.1 ? It's possible that this works now.
retry with the latest version 4.0.2, got that same error
Hi @iwater Can you describe your setup so that I can reproduce this? NodeVersion, OS-type, npm-version etc..
The error comes with ios and i dont have or will have any apple-device to reproduce. It also looks like the error is a problem with the react-native build, not with rxdb itself.
So I'm closing this for now with a wontfix-label. Please reopen if you know how to fix this.
I just tried the latest example by rxdb commit use these steps from README
follow installation instructions to setup your react-native environment
clone the whole RxDB-repo
go into project cd rxdb
run npm install
go to this folder cd examples/react-native
run npm install
run react-native run-ios or react-native run-android
test env: NodeVersion: 8.1.0, OS-type: macOS 10.12.5, npm-version: 5.0.3
first start got this error
after npm install util and restart got this error
this unhandled promise point to util.validateCouchDBString which got a undefined argument
I dig the source find that
create function in index.js accept four arguments in comment and direct call RxDatabase exported create function, but that function accept a object argument wrap that four arguments and in react-native example code just call with four plain arguments, so that util.validateCouchDBString failed
code in example
RxDB.create('heroesReactDataBase1', 'asyncstorage', 'myLongAndStupidPassword', true).then((db) => {
code in index.js
/**
* create a database
* @param {string} prefix as databaseName for the storage (this can be the foldername)
* @param {Object} storageEngine any leveldown instance
* @param {String} password if the database contains encrypted fields
* @param {boolean} multiInstance if true, multiInstance-handling will be done
* @return {Promise<Database>}
*/
export async function create(args) {
return RxDatabase.create(args);
}
code in RxDatabase.js
export async function create({
name,
adapter,
password,
multiInstance = true
}) {
util.validateCouchDBString(name); // promise reject
and in the example database name is heroesReactDataBase1, but in util check regex is
const regStr = '^[a-z][a-z0-9]*$';
mean it should be lowercase for whole string
and heroSchema in example is missing version as required
BTW, because react-native have it's es6 compile process, maybe It should be better not publish .babelrc to npm registry (because that not compatible with react-native compile env, maybe not compatible others too), and referer rxdb with
import * as RxDB from 'rxdb/src/';
instead of
import * as RxDB from 'rxdb';
to let react-native compile rxdb source for it's env
Thank you for the PR!
I added babelrc to gitignore since redux and other libs also do not publish them because of webpack-build-fails.
What is the benefit of using rxdb/src/
? I thought without babelrc, the react-native-build would just not compile the module by itself and use the path given in the package.json. Or am I wrong?
closing this since the original issue seems to be solved.
after the steps from here https://github.com/pubkey/rxdb/tree/master/examples/react-native use yarn instead of npm