0

Trying to start pm2 it runs for a run then crashes right after this log pops up constantly. /home/ubuntu/418_Assign_3/express/assign3.html:1 <!doctype html> ^

SyntaxError: Unexpected token '<' at Object.compileFunction (node:vm:360:18) at wrapSafe (node:internal/modules/cjs/loader:1055:15) at Module._compile (node:internal/modules/cjs/loader:1090:27) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10) at Module.load (node:internal/modules/cjs/loader:1004:32) at Function.Module._load (node:internal/modules/cjs/loader:839:12) at Object. (/home/ubuntu/.nvm/versions/node/v16.17.1/lib/node_modules/pm2/lib/ProcessContainerFork.js:33:23) at Module._compile (node:internal/modules/cjs/loader:1126:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10) at Module.load (node:internal/modules/cjs/loader:1004:32)

I am hosting the server on ec2.

this is my Web code.

<!doctype html>
<html lang="en">
  <head>
    <script type="text/javascript">
      function add(){
        var first_number = parseInt(document.getElementById("Text1").value);
                var second_number = parseInt(document.getElementById("Text2").value);
                var result = first_number + second_number;
    
                document.getElementById("txtresult").value = result;   
      }
    </script>
    <style>
      .column {
  float: left;
  width: 33.33%;
  padding: 5px;
}
.myDiv {
  border: 1px outset gray;
  background-color: rgb(255, 255, 255);
  width: 500px; height: 400px; 
  text-align: center;
}
.row::after {
  content: "";
  clear: both;
  display: table;
}

    </style>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Bootstrap CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">

    <title>Adelson Jules WebApp.</title>
  </head>
    <div>
      <div style="float: left">
        
      <img src="https://418assign3bucket.s3.amazonaws.com/5A89A94D-5131-447C-9423-F888695C1C60.jpeg" style="width: 300px; height: 300px;" />
      </div>
      <div>
        <h2 style="border: 1px outset blue; "> Adelson Jules WebApp.</h2>
          <p style="border: 1px outset red; width: fit-content; "> Hi my name is AJ this is my assignment and I cant belive i being a real Software Engineer. </p> 
      </div>
    </div>
      

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script>
  </body>
  <form action="/endpoint" method="post">
    Enter First Number : <br>
    <input type="text" id="Text1" name="TextBox1">
    <br>
    Enter Second Number : <br>
    <input type="text" id="Text2" name="TextBox2">
    <br>
    Result : <br>
    <input type="text" id="txtresult" name="TextBox3">
    <br>
 <input type="button" name="clickbtn" value="Display Result" onclick="add()">
</form>
</html>
  • Not shure what you have do, but if you try starting a node process with HTML code, you can't. Node.js need a javascript script. Can you explain what you did? – Alaindeseine Oct 09 '22 at 08:06

0 Answers0