feross/simple-peer

Process not defined when triggering peer.on("connect") and peer.on("data") in reactjs

idiosyncrasy00 opened this issue · 8 comments

Hello. I am having issues when implementing simple-peer in reactjs, which is whenever another person joins the room, it cannot trigger these two functions of simple-peer. However my implementation works fine in a non-framework web (using plain javascript and html).
The almost similar issue can be found here:
https://stackoverflow.com/questions/70899364/simple-peer-on-data-stream-throws-process-not-defined-error
Thank you for reading.

Velua commented

Make sure you're using vanilla React as I was using Vite before and it wouldn't work.

I am getting the same error

I'm having a similar issue with simple-peer and reacjs, also the console throw a readable stream error when using peer.on("data")

I have the same problem. Was able to fix it by using the simplepeer.min.js file instead of the node module.

Same problem using this example with Create React App

getting this too on create-react-app

It helped me to fix an issue with create-react-app. It's important to init before simple-peer
https://stackoverflow.com/a/77078047/5700121

This should be the answer: #767