10:06 AM
at Object._errnoException (util.js:992:11)
10:06 AM
at _exceptionWithHostPort (util.js:1014:20)
10:06 AM
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1186:14)
10:06 AM
(node:7091) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 29)
Any idea what the problem is? (I am new to node.js and server-side scripting so I have no idea what that error message is) Any help would be appreciated
You’re only able to use one port for one thing at a time, so you can get an ECONNREFUSED error when trying to start something else using the already-in-use port (we recommend you use port 3000). It’s difficult to know what specifically might be causing it without seeing the code. Let us know the project name and we’ll take a look. If your project is private, either make it public temporarily or DM me a join link so we can view the code. Thanks.
Hello! Thanks for taking your time to answer on my problem
If you mean on the code in ‘server.js’ it is this one (actually I haven’t changed anything because I, as stated above, don’t know a lot about server side stuff so I didn’t want to break something):
// server.js
// where your node app starts
// init project
var express = require(‘express’);
var app = express();
// we’ve started you off with Express,
// but feel free to use whatever libs or frameworks you’d like through package.json.
// listen for requests
var listener = app.listen(process.env.PORT, function () { // env.port = 3000
console.log('Your app is listening on port ’ + listener.address().port);
});
Thanks. We need to see the code in full, not just snippets, which is why I asked for the project name. Please let us know the project name and we’ll take a look. If your project is private, either make it public temporarily or DM me a join link so we can view the code.