ReferenceError: ReadableStream is not defined, Command PhaseScriptExecution failed with a nonzero exit code

ReferenceError: ReadableStream is not defined at Object.<anonymous> (/Users/anaadmin/Documents/AnaNewApp/node_modules/@expo/cli/node_modules/undici/lib/web/fetch/response.js:528:3) at Module._compile (node:internal/modules/cjs/loader:1198:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10) at Module.load (node:internal/modules/cjs/loader:1076:32) at Function.Module._load (node:internal/modules/cjs/loader:911:12) at Module.require (node:internal/modules/cjs/loader:1100:19) at require (node:internal/modules/cjs/helpers:119:18) at Object.<anonymous> (/Users/anaadmin/Documents/AnaNewApp/node_modules/@expo/cli/node_modules/undici/lib/web/fetch/index.js:11:5) at Module._compile (node:internal/modules/cjs/loader:1198:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)

After trying out all suggestions and different versions of tools such as XCode, nvm, yarn, node, etc., nothing works for me

  1. i added :

<PROJECT_PATH>/node_modules/@langchain/core/dist/utils/stream.cjs - add const { ReadableStream } = require("web-streams-polyfill"); npm install web-streams-polyfill

  1. Tried downgrading to Node 18 as well as various polyfills but haven't been able to get it to work

  2. Following does not work in xcode

  • Delete your Podfile.lock (I like to use the command '-rm -rf Podfile.lock' on the terminal for this)
  • Delete your Pods folder (I like to use the command '-rm -rf Pods' in the terminal for this)
  • Delete your .xcworkspace
  • Pod install
  1. Clear your project into XCode> Product> Clean Build Folder

  1. i have tried
  • cd ios
  • pod install

Continuously i am getting same error. Any one know, how to resolve this error

ReferenceError: ReadableStream is not defined, Command PhaseScriptExecution failed with a nonzero exit code
 
 
Q