error : bundling failed: Error: While trying to resolve module url-parse from file /Users/syedhasan/Documents/POS/node_modules/realm/lib/extensions.js
I am trying to initialize realm in react-native on ios and Android.
The realm will create a database and insert a record into the created database
Android build looks fine with data insertion and fetching.
but on ios, it throws me the error for failing to load.
6:40:17 +0000] "GET /index.bundle?platform=ios&dev=true&minify=false HTTP/1.1" 2 BUNDLE [ios, dev] ./index.js 鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒鈻戔枒 0.0% (0/1), failed.
error: bundling failed: Error: While trying to resolve module url-parse from file /POS/node_modules/realm/lib/extensions.js, the package /POS/node_modules/realm/node_modules/url-parse/package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (/Users/syedhasan/Documents/POS/node_modules/realm/node_modules/url-parse/index.js. Indeed, none of these files exist:
What are the steps we can follow to reproduce this issue?
install realm on the created react native project with the following version's
"react": "16.8.3",
"react-native": "0.59.1",
"realm": "^2.25.0"
initialize realm
const Realm = require('realm');
const MenuSchema = {
name: 'Menu',
properties: {
name: 'string',
addons: 'string[]',
price: 'int',
qty : 'int'
}
}
componentWillMount() {
Realm.open({
schema: [MenuSchema]
}).then(realm => {
realm.write(() => {
realm.create('Menu', {
name: 'chicken briyani',
addons: ['raita','onion'],
price: 180,
qty : 2
});
realm.create('Menu', {
name: 'mutton briyani',
addons: ['extra onion', 'raita', 'korma'],
price: 230,
qty : 1
});
});
});
}
Another issue failed to build on ios
error: bundling failed: Error: While trying to resolve module deepmerge from file /POS/node_modules/realm/lib/user-methods.js, the package /POS/node_modules/realm/node_modules/deepmerge/package.json was successfully found. However, this package itself specifies a main module field that could not be resolved (/POS/node_modules/realm/node_modules/deepmerge/dist/umd.js. Indeed, none of these files exist:
realmJs update to 2.26 it's fix this problem
I'll close this issue now once update applied on realm 2.26 will check.
Hey - looks like you forgot to add a T:* label - could you please add one?
Most helpful comment
realmJs update to 2.26 it's fix this problem