0

I am deploying Node.js into Azure APP service while deploying i am getting the error

error in URL

The page cannot be displayed because an internal server error has occurred.

error in Azure Console

\node [master*]> node index.js
Note: Opening a port for access from a browser is not supported in this environment. To run and browse your application, press the 'Run' button in the toolbar.
welcome node server 
welcome db.js 
events.js:167
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE \\.\pipe\0bed3880-e538-4076-b6f3-d48a9f37861c
    at Server.setupListenHandle [as _listen2] (net.js:1269:19)
    at listenInCluster (net.js:1334:12)
    at Server.listen (net.js:1432:5)
    at Function.listen (D:\home\site\wwwroot\node\node_modules\express\lib\application.js:618:24)
    at Object.<anonymous> (D:\home\site\wwwroot\node\index.js:79:5)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
Emitted 'error' event at:
    at emitErrorNT (net.js:1313:8)
    at process._tickCallback (internal/process/next_tick.js:63:19)
    at Function.Module.runMain (internal/modules/cjs/loader.js:744:11)
    at startup (internal/bootstrap/node.js:285:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
\node [master*]> 

Code is working fine in my local system but its not working in Azure ,I don't know the reason why i am getting this error in Azure .

My code :

console.log('welcome node server ');

const mysql = require('mysql');
const express = require('express');
// var router = express.Router();
const app = express();
const bodyParser = require('body-parser');
const path = require('path');
const fs = require('fs');
const multer = require('multer');

app.use(bodyParser.urlencoded({ extended: true }));
app.use(bodyParser.json());



var connection = require('./db.js');
const cors = require('cors');
// app.use(cors())
// app.use(cors({ origin: "http://localhost:4200", credentials: true }));





//PORT ENVIRONMENT VARIABLE
const port = process.env.PORT || 8080;
app.listen(port, () => { console.log(`APP listening on port ${port}!!!`) });


// var port = process.env.PORT || 1337;
// const PORT = 443;

// app.listen(3600, () => { })
//app.listen(process.env.PORT || 443);
// var port = process.env.PORT || 3031,
// app.listen('port', 3031);


Once check my code i tried different port numbers in different forms but still it is not working , So please tell me if anyone know the solution.

Sivasankar chimata
  • 311
  • 1
  • 16
  • 31
  • Have you pass environment value of PORT? If yes then check if any other service is running on same port. – Rahul Patil Dec 09 '19 at 05:44
  • Thank your for the valuable response Sir i am using below code for that its working fine in local system ```const port = process.env.PORT || 8080; app.listen(port, () => { console.log(`APP listening on port ${port}!!!`) });``` when i check the code in Kudu Debug Console CMD , i am not getting any error But when i check it in app Service editor i am getting the above errors. – Sivasankar chimata Dec 09 '19 at 05:58
  • Try once const port = 80; instead of 8080. As you are not passing any environmental value for port. Just make sure once, that apache is not running on same port. – Rahul Patil Dec 09 '19 at 06:40
  • Sir it is also not working do you have any better solution Please once check my code clearly , i am already tried with different port number my web URL : (http://howtags.azurewebsites.net/) – Sivasankar chimata Dec 09 '19 at 06:48
  • Error your are showing is clearly implies that any other service also using same port. If you have terminal access then check netstat for your port. https://stackoverflow.com/a/55788465/8633285 check this. – Rahul Patil Dec 09 '19 at 06:56
  • I got the problem in Azure APP SERVICE not in my local system – Sivasankar chimata Dec 09 '19 at 07:47

0 Answers0