Parse-SDK-JS icon indicating copy to clipboard operation
Parse-SDK-JS copied to clipboard

The package at "node_modules/parse/node_modules/ws/lib/stream.js" attempted to import the Node standard library module "stream"

Open lawrenehi opened this issue 6 months ago • 9 comments

New Issue Checklist

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.

lawrenehi avatar Jun 02 '25 10:06 lawrenehi

🚀 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

lawrenehi avatar Jun 02 '25 10:06 lawrenehi

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

lawrenehi avatar Jun 02 '25 10:06 lawrenehi

Basically ws is not used in react-native but it didn't get cleaned up (tree-shaking) when the build was output.

Image

dplewis avatar Jun 02 '25 15:06 dplewis

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"

riohifi avatar Jul 05 '25 09:07 riohifi

same error, latest parse does not work with react 0.79

chr4ss1 avatar Jul 22 '25 20:07 chr4ss1

+1

UsamaAshraf82 avatar Aug 09 '25 12:08 UsamaAshraf82

facing similar issue

Emehado avatar Aug 12 '25 23:08 Emehado

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

UsamaAshraf82 avatar Aug 13 '25 01:08 UsamaAshraf82