Realm-js: While trying to resolve module `url-parse` from file

Created on 26 Mar 2019  路  4Comments  路  Source: realm/realm-js

error : bundling failed: Error: While trying to resolve module url-parse from file /Users/syedhasan/Documents/POS/node_modules/realm/lib/extensions.js

What are you trying to achieve?

I am trying to initialize realm in react-native on ios and Android.

What did you expect to happen?

The realm will create a database and insert a record into the created database

What happened instead?

Android build looks fine with data insertion and fetching.
but on ios, it throws me the error for failing to load.

e.g. the stack trace of a crash

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:

Steps to Reproduce

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

Code Sample

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 }); }); }); }

Version of Realm and Tooling

  • Realm JS SDK Version: ? 2.25.0
  • Node or React Native: ? 0.59.1
  • Client OS & Version: ? macOS High Sierra - 10.13.6
  • Which debugger for React Native: None
O-Community T-Bug

Most helpful comment

realmJs update to 2.26 it's fix this problem

All 4 comments

Another issue failed to build on ios

stack trace

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?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ashah888 picture ashah888  路  3Comments

kontinuity picture kontinuity  路  3Comments

fever324 picture fever324  路  4Comments

ugendrang picture ugendrang  路  3Comments

MihaelIsaev picture MihaelIsaev  路  3Comments