close

[Solved] node.js Error: connect ECONNREFUSED; response from server

Hello Guys, How are you all? Hope You all Are Fine. Today I get the following error node.js Error: connect ECONNREFUSED; response from server in javascript. So Here I am Explain to you all the possible solutions here.

Without wasting your time, Let’s start This Article to Solve This Error.

How node.js Error: connect ECONNREFUSED; response from server Error Occurs?

Today I get the following error node.js Error: connect ECONNREFUSED; response from server in javascript.

How To Solve node.js Error: connect ECONNREFUSED; response from serverError ?

  1. How To Solve node.js Error: connect ECONNREFUSED; response from serverError ?

    To Solve node.js Error: connect ECONNREFUSED; response from serverError From your code, It looks like your file contains code that makes get request to localhost (127.0.0.1:8000). The problem might be you have not created server on your local machine which listens to port 8000 For that you have to set up server on localhost which can serve your request.

  2. node.js Error: connect ECONNREFUSED; response from server

    To Solve node.js Error: connect ECONNREFUSED; response from serverError From your code, It looks like your file contains code that makes get request to localhost (127.0.0.1:8000). The problem might be you have not created server on your local machine which listens to port 8000 For that you have to set up server on localhost which can serve your request.

Solution 1

From your code, It looks like your file contains code that makes get request to localhost (127.0.0.1:8000).

The problem might be you have not created server on your local machine which listens to port 8000.

For that you have to set up server on localhost which can serve your request.

  1. Create server.jsvar express = require('express'); var app = express(); app.get('/', function (req, res) { res.send('Hello World!'); // This will serve your request to '/'. }); app.listen(8000, function () { console.log('Example app listening on port 8000!'); });
  2. Run server.js : node server.js
  3. Run file that contains code to make request.

Solution 2

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you? Thank You.

Also Read

Leave a Comment