realm-js icon indicating copy to clipboard operation
realm-js copied to clipboard

React Native Crash on compilation

Open dsemelianov opened this issue 9 months ago • 2 comments

How frequently does the bug occur?

Always

Description

Our React Native app uses Realm. After upgrading to the latest version of expo and also upgrading our React Native version (in order to build our app using iOS 17) we are encountering this error when bundling the app for iOS:

iOS Bundling failed 9170ms (index.js)
The package at "node_modules/realm/dist/platform/node/custom-inspect.js" attempted to import the Node standard library module "node:util".
It failed because the native React runtime does not include the Node standard library.

No idea why this is happening. Here is my package.json:

{ "name": "my-app", "version": "1.0.0", "scripts": { "start": "expo start --dev-client", "android": "expo run:android", "ios": "expo run:ios", "web": "expo start --web", "eas-build-on-success": "npx bugsnag-eas-build-on-success" }, "dependencies": { "@bugsnag/expo": "^50.0.0", "@qeepsake/react-native-image-exif": "^1.0.1", "@react-native-async-storage/async-storage": "^1.23.1", "@react-native-camera-roll/camera-roll": "^7.5.2", "@react-native-community/checkbox": "^0.5.17", "@react-native-community/netinfo": "11.1.0", "@realm/react": "^0.6.2", "@reduxjs/toolkit": "^2.2.3", "base-64": "^1.0.0", "expo": "^50.0.0", "expo-application": "~5.8.4", "expo-constants": "~15.4.6", "expo-crypto": "~12.8.1", "expo-device": "~5.9.4", "expo-file-system": "~16.0.9", "expo-image": "~1.10.6", "expo-linear-gradient": "^12.7.2", "expo-media-library": "~15.9.1", "i18next": "^23.11.2", "jimp": "^0.22.12", "mixpanel-react-native": "^3.0.2", "pixelmatch": "^5.3.0", "react": "18.2.0", "react-error-boundary": "^4.0.13", "react-i18next": "^14.1.0", "react-native": "0.73.6", "react-native-base64": "^0.2.1", "react-native-canvas": "^0.1.39", "react-native-exif": "^0.5.0", "react-native-gesture-handler": "^2.16.0", "react-native-get-random-values": "^1.11.0", "react-native-in-app-review": "^4.3.3", "react-native-permissions": "^4.1.5", "react-native-progress": "^5.0.1", "react-native-progress-bar-animated": "^1.0.6", "react-native-purchases": "^7.26.2", "react-native-restart": "^0.0.27", "react-native-shimmer-placeholder": "^2.0.9", "react-native-store-review": "^0.4.3", "react-native-svg": "^15.1.0", "react-native-vector-icons": "^10.0.3", "react-native-webview": "^13.8.4", "react-redux": "^9.1.0", "realm": "^12.6.2", "@emotion/react": "^11.10.6", "@emotion/styled": "^11.10.5", "@fontsource/roboto": "^4.5.8", "@formatjs/intl-pluralrules": "^5.2.7", "@microsoft/microsoft-graph-client": "^3.0.7", "@react-navigation/drawer": "^6.6.4", "@types/gapi": "^0.0.43", "@types/gapi.client.gmail": "^1.0.4", "@types/node": "^17.0.45", "@types/react": "^18.0.27", "expo-auth-session": "~5.4.0", "expo-dev-client": "~3.3.11", "expo-splash-screen": "~0.26.5", "expo-status-bar": "~1.11.1", "expo-web-browser": "~12.8.2", "express": "^4.18.2", "extract-domain": "^2.4.8", "heroku-ssl-redirect": "^0.1.1", "htmlparser2": "^9.0.0", "lodash": "^4.17.21", "luxon": "^3.2.1", "minimatch": "^9.0.0", "mixpanel-browser": "^2.45.0", "moment": "^2.29.4", "nanoid": "^4.0.1", "query-string": "^8.1.0", "react-canvas-confetti": "^1.3.0", "react-infinite-scroll-component": "^6.1.0", "react-native-appsflyer": "^6.12.2", "react-native-dotenv": "^3.4.9", "react-native-eject": "^0.2.0", "react-native-elements": "^3.4.3", "react-native-os": "^1.2.6", "react-native-paper": "^5.12.3", "react-native-reanimated": "~3.6.2", "react-native-safe-area-context": "4.8.2", "react-native-simple-toast": "^3.2.0", "react-native-svg-transformer": "^1.1.0", "react-native-toast-message": "^2.1.6", "react-native-tracking-transparency": "^0.1.2", "react-navigation": "^5.0.0", "retry": "^0.13.1", "run": "^1.4.0", "sass": "^1.59.3", "serve": "^14.1.2", "typescript": "^4.9.4", "web-vitals": "^2.1.4" }, "devDependencies": { "@babel/cli": "^7.19.3", "@babel/core": "^7.20.0", "@babel/plugin-proposal-class-properties": "^7.18.6", "@babel/plugin-proposal-decorators": "^7.20.2", "@babel/plugin-transform-runtime": "^7.19.6", "@babel/preset-env": "^7.20.2", "@babel/preset-typescript": "^7.18.6", "@babel/register": "^7.18.9", "@bugsnag/plugin-expo-eas-sourcemaps": "^48.0.0", "@bugsnag/source-maps": "^2.3.1", "@faker-js/faker": "^7.6.0", "@microsoft/microsoft-graph-types": "^2.40.0", "@svgr/webpack": "^6.5.1", "@tsconfig/react-native": "^3.0.0", "@types/extract-domain": "^2.3.1", "@types/fast-html-parser": "^1.0.2", "@types/jest": "^29.5.1", "@types/lodash": "^4.14.190", "@types/mixpanel-browser": "^2.38.0", "@types/nanoid": "^3.0.0", "@types/node": "^20.8.6", "@types/query-string": "^6.3.0", "@types/react": "~18.2.45", "@types/react-native-base64": "^0.2.0", "@types/react-navigation": "^3.4.0", "@types/react-test-renderer": "^18.0.0", "@types/react-virtualized-auto-sizer": "^1.0.1", "@types/react-window": "^1.8.5", "@types/retry": "^0.12.3", "@typescript-eslint/eslint-plugin": "^5.47.0", "@typescript-eslint/parser": "^5.47.0", "chai": "^4.3.7", "eslint": "^8.30.0", "eslint-plugin-react": "^7.31.11", "fake-indexeddb": "^4.0.0", "fishery": "^2.2.2", "json5": "^2.2.2", "mocha": "^10.1.0", "mockdate": "^3.0.5", "node-fetch": "^3.3.0", "prettier": "^2.8.0", "timekeeper": "^2.2.0", "typescript": "^5.3.0" }, "private": true, "engines": { "node": ">=18" } }

Stacktrace & log output

iOS Bundling failed 9170ms (index.js)
The package at "node_modules/realm/dist/platform/node/custom-inspect.js" attempted to import the Node standard library module "node:util".
It failed because the native React runtime does not include the Node standard library.

> const node_util_1 = require("node:util");
                             ^

Can you reproduce the bug?

Always

Reproduction Steps

No response

Version

12.6.2

What services are you using?

Local Database only

Are you using encryption?

No

Platform OS and version(s)

iOS

Build environment

Which debugger for React Native: ..

Cocoapods version

No response

dsemelianov avatar Apr 29 '24 00:04 dsemelianov

➤ PM Bot commented:

Jira ticket: RJS-2812

sync-by-unito[bot] avatar Apr 29 '24 00:04 sync-by-unito[bot]

It looks like Metro is picking up our Node.js entrypoint when bundling. Could you share your metro configuration? For one thing, wondering if you have unstable_enablePackageExports enabled.

kraenhansen avatar Apr 29 '24 07:04 kraenhansen

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

github-actions[bot] avatar May 21 '24 00:05 github-actions[bot]