I created expressjs application using the following commands:
express -e folderName
npm install ejs --save
npm install
When I run the appli
In my case I've had to run vagrant reload
as well. Even with no node processes running my express app in my virtual machine I was still getting this error until reloading the vagrant box.
We do get similar error when we sometimes run our express app. We have to follow the same in that case. We need to check if its running in any terminal. If you want to find and kill process, follow these steps:
OR
Use a single command to close all the running node processes.
ps aux | awk '/node/{print $2}' | xargs kill -9
The port Node is trying to use can be already used by another program. In my case it was ntop, which I had recently installed. I had to open http://localhost:3000/ in a browser to realize it. Another way to find the process is given here.
In-order to fix this, terminate or close the server you are running. If you are using Eclipse IDE, then follow this,
Run > Debug
Right-click the running process and click on Terminate.
Actually Ctrl+C keys not releasing port used by node process. So there is this error. The resolution to the issue was using following code snippet in server.js:
process.on('SIGINT', function() {
console.log( "\nGracefully shutting down from SIGINT (Ctrl-C)" );
// some other closing procedures go here
process.exit(1);
});
This worked for me.
You can also check for other solutions mentioned at Graceful shutdown in NodeJS
My answers is one of the solution
If you are trying to run angular application with below command
ng serve --open
--open Opens the url in default browser this tag is causing the issue. i don't know what is the purpose after angular 10 version which is not working. I am still analysing