Ask coding questions

← Back to all posts
How to use peerjs
coding1001 (15)

How do I use Peerjs in a nodejs REPL. To Use Peerjs you usually have to use npm i -g peer to install and then use peerjs --port 3001. install-pkg does not work in nodejs REPLs. How do i install peerjs?

Comments
hotnewtop
coding1001 (15)

@JohnBarnhart i need to use the peerjs command in the terminal

TheBest156 (43)

@coding1001 Ok, breaking it into different parts.

what are you using it for on your project?

TheBest156 (43)

@coding1001 Hold on, gotta eat lunch, I'll help you later.

TheBest156 (43)

@coding1001 got school work to do in classes and exams all day. maybe later if I got time around 5 pm or 4 pm eastern time.

coding1001 (15)

@TheBest156 my code works on my computer with:
sudo npm i -g peer
peerjs —port 3001
node server.js
The problem is it is only on localhost and I want to access it from any device, not just the ones connected to my network

coding1001 (15)

@TheBest156 how do i use it in replit?

TheBest156 (43)

@coding1001 can I edit it to try to help?

coding1001 (15)

@TheBest156 the REPL? Should I invite you to it?

TheBest156 (43)

@coding1001 sure, Don't have much time, only got 10-15 minutes left until next class in school.