Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

164
Views
can't fix ExpressPeerServer is not a function in server.js

I am stuck in a error where I have successfully installed peer.js library in my npm project but in my server.js file, when I try to import peer library and use it as a function, it is saying that peerServer is not a function.

const express = require('express');
const app = express()
const server = require("http").Server(app);
const {v4:uuidv4} = require("uuid")
const io = require("socket.io")(server);
const peerServer = require("peer");
const ExpressPeerServer = peerServer(server, {
    debug: true,
})

app.use(express.static('public'));
app.set('view engine', 'ejs');

app.get("/", (req, res)=>{
    res.redirect(`/${uuidv4()}`)
})
app.get('/:room', (req, res)=>{
   res.render('room', {roomId : req.params.room})
})

server.listen(3000, ()=>{
    console.log("Server is running on port 3000")
})

enter image description here

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

From the Peer readme.

const { PeerServer } = require('peer');
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!