The package at "node_modules/parse/node_modules/ws/lib/stream.js" attempted to import the Node standard library module "stream"
New Issue Checklist
- [x] I am not disclosing a vulnerability.
- [x] I am not just asking a question.
- [x] I have searched through existing issues.
- [x] I can reproduce the issue with the latest versions of Parse Server and the Parse JS SDK.
Issue Description
On react-native with expo - build , the launch/build fails with the following error if you add events and stream, you get http and https error too
Android Bundling failed 612ms node_modules/expo-router/entry.js (1315 modules)
The package at "node_modules/parse/node_modules/ws/lib/stream.js" attempted to import the Node standard library module "stream".
It failed because the native React runtime does not include the Node standard library.
Steps to reproduce
Create a react native app using
- npx create-expo-app@latest
- npm i parse#
- const Parse = require('parse/react-native.js');
- npx expo run:android
- run the app on emulator or mobile
Actual Outcome
App should build
Expected Outcome
Environment
"expo-system-ui": "~5.0.7", "expo-web-browser": "~14.1.6", "parse": "^6.1.1", "react": "19.0.0", "react-dom": "19.0.0", "react-native": "0.79.2",
Server NA
Database NA
Client
- Parse JS SDK version:
6.1.1
Logs
Android Bundling failed 612ms node_modules/expo-router/entry.js (1315 modules) The package at "node_modules/parse/node_modules/ws/lib/stream.js" attempted to import the Node standard library module "stream". It failed because the native React runtime does not include the Node standard library.
🚀 Thanks for opening this issue!
ℹ️ You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.
found a probable workaround from the expo team
https://docs.expo.dev/versions/latest/config/metro/#packagejsonexports
const { getDefaultConfig } = require('expo/metro-config');
/** @type {import('expo/metro-config').MetroConfig} */
const config = getDefaultConfig(__dirname);
config.resolver.unstable_enablePackageExports = false;
module.exports = config;
i will test to see if this has an impact on Parse, but it seems to take away the error. This issue might be related to ws required by Parse
not related but this error should be in the documentation for latest react-native
https://github.com/uuidjs/uuid?tab=readme-ov-file#getrandomvalues-not-supported
Basically ws is not used in react-native but it didn't get cleaned up (tree-shaking) when the build was output.
node_modules/parse/node_modules/ws/lib/stream.js: stream could not be found within the project or in these directories: node_modules/parse/node_modules node_modules ../../../../node_modules 1 | 'use strict'; 2 |
3 | const { Duplex } = require('stream'); | ^ 4 |
"@d11/react-native-fast-image": "^8.9.2", "@parse/react-native": "^0.0.1-alpha.18", "@react-native-async-storage/async-storage": "^2.2.0", "@react-native/new-app-screen": "0.80.0", "@react-navigation/bottom-tabs": "^7.3.17", "@react-navigation/native": "^7.1.13", "@react-navigation/stack": "^7.3.6", "lottie-react-native": "^7.2.3", "nativewind": "^4.1.23", "parse": "^5.3.0", "react": "19.1.0", "react-native": "0.80.0", "react-native-gesture-handler": "^2.26.0", "tailwindcss": "^3.4.17"
same error, latest parse does not work with react 0.79
+1
facing similar issue
found a probable workaround from the expo team
https://docs.expo.dev/versions/latest/config/metro/#packagejsonexports
const { getDefaultConfig } = require('expo/metro-config'); /** @type {import('expo/metro-config').MetroConfig} */ const config = getDefaultConfig(__dirname); config.resolver.unstable_enablePackageExports = false; module.exports = config;i will test to see if this has an impact on Parse, but it seems to take away the error. This issue might be related to ws required by Parse
This is working