Node.js 无法在heroku上正确部署node js应用程序

Node.js 无法在heroku上正确部署node js应用程序,node.js,heroku,deployment,video-streaming,production-environment,Node.js,Heroku,Deployment,Video Streaming,Production Environment,我制作了一个视频通话应用程序,在本地电脑上运行良好,但当我将所有文件推送到heroku时,我无法看到其他人的视频 下面是我的script.js(前端客户端文件): 这是文件室目录中的room.ejs文件: <!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <ti

我制作了一个视频通话应用程序,在本地电脑上运行良好,但当我将所有文件推送到heroku时,我无法看到其他人的视频

下面是我的script.js(前端客户端文件):

这是文件室目录中的room.ejs文件:

    <!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title>Room</title>
      <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="/style.css">

    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">

    <script src="https://unpkg.com/peerjs@1.3.1/dist/peerjs.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/peerjs/1.3.1/peerjs.js"></script>
    <script src="/socket.io/socket.io.js"></script>

    <script type="text/javascript">
      const ROOM_ID = "<%= roomId %>";
      const port = "<%= myPort %>";
      const host = "<%= myHost %>";
    </script>
  </head>
  <body>
    <h1>Hi there!</h1>
    <div class="main">
      <div class="main__left">
        <div class="main__videos">
          <div id="video-grid">
          </div>
        </div>

    </div>
      </div>

    <script src="/script.js">

    </script>
  </body>
</html>
我无法确定是否进行了部署所需的正确更改。请帮我确定我是否遗漏了一些代码


谢谢

您是否在项目的根目录中定义了Procfile?是的,我已经添加了它。“web:node server.js”这是procfile中的代码。
require("dotenv").config();
const express = require("express");
const app = express();

//making server constant
const server = require("http").Server(app);

//requirinng uuid package
const { v4 : uuidv4 } = require("uuid");

//declaring io constant
const io = require("socket.io")(server);


//using peer server
const {ExpressPeerServer} = require("peer");
const peerServer = ExpressPeerServer(server, {
  debug: true
})

//setting view engine to ejs and express to use static files
app.set("view engine", "ejs");
app.use(express.static("public"));

//
app.use("/a", peerServer);


//when user gets on the home route, it redirects him to new room
app.get("/", function(req, res){
  const id = uuidv4();
  res.redirect("/"+ id);
})

//listening on port 3030
const port = process.env.PORT || 3030;
server.listen(port);

//using routing parametes of express, to pass different room files to
//different rooms
app.get("/:room", function(req,res){
  console.log(req.hostname);
  res.render("room", {roomId:req.params.room, myPort:port, myHost: req.hostname});
})



//on connection of any new user
io.on("connection", function(socket){
  //when joinroom is emmited from frontend along with roomid and,
  //userId, this code inside it will be executed
  socket.on("join-room", function(roomId, userId){
    socket.join(roomId);
    socket.to(roomId).emit("user-connected", userId);


  })
})
    <!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title>Room</title>
      <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <link rel="stylesheet" href="/style.css">

    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">

    <script src="https://unpkg.com/peerjs@1.3.1/dist/peerjs.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/peerjs/1.3.1/peerjs.js"></script>
    <script src="/socket.io/socket.io.js"></script>

    <script type="text/javascript">
      const ROOM_ID = "<%= roomId %>";
      const port = "<%= myPort %>";
      const host = "<%= myHost %>";
    </script>
  </head>
  <body>
    <h1>Hi there!</h1>
    <div class="main">
      <div class="main__left">
        <div class="main__videos">
          <div id="video-grid">
          </div>
        </div>

    </div>
      </div>

    <script src="/script.js">

    </script>
  </body>
</html>
    {
  "name": "zoom-clone",
  "version": "1.0.0",
  "description": "",
  "main": "server.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "ejs": "^3.1.6",
    "express": "^4.17.1",
    "peer": "^0.5.3",
    "socket.io": "^2.4.1",
    "uuid": "^8.3.2"
  }
}