Gruntjs + nodemon - node.js

I keep getting the error show in the image when running nodemon with watch & node inspector with the sails.js framework
Anyone come across this before??

EADDRINUSE means the port the server try to bind is currently in use.
In this case, your port 1337 and 3000 have been occupied by other server already. You should change your configuration or kill the processes that occupy the ports.

Related

WebSockets request was expected error when using --inspect-brk option

When I run nodemon dist/server/app.js it works on default port 3000 and I'm able to reach my API. But if I run
nodemon --inspect-brk=localhost:3000 dist/server/app.js
I got error
WebSockets request was expected
What's wrong?
You can't run your web server and the debugger on the same port. They are each separate servers (the debugger is a server built into the node.js runtime).
So, you can either remove the port and host designation from the --inspect-brk option and just let it use the defaults (which is all I ever use) or you can select a different port for the debugger that doesn't conflict with your web server or anything else running on that host.

App not starting with pm2 after stopping execution

I have an app set to listen to port 66.
First I tried to run it with sudo node myapp.js . I was able to access it at the correct url (ip:66). Then I stopped the app (Ctrl+c) and started it with pm2, sudo pm2 start app.js. The status is online. However, that same url is now inaccessible.
Running sudo pm2 logs while the app is started with pm2 gives me the error EACCESS for port 66. No one else is running the app, and I am sure I am only using one console and killing the node service before starting it with pm2.
Pm2 was installed globally. Server is Debian stretch. Nodejs version is 8.x
I am logging as a normal user and using sudo to run the app.
on linux systems normal users are not allowed to listen to ports below 1024. There are several ways around this.
You can change this rule to allow non root users to open such ports. But this is a security risc and is not recommended. So i won't add a link to this solution.
you can also listen to a port that is greater than 1024 and then use a forward rule in your firewall to route port 66 to the port you opened.
https://www.systutorials.com/816/port-forwarding-using-iptables/
my (and pm2's) prefered solution is to listen to a port greater than 1024 and use a reverse proxy like nginx to route apps running on that server.
http://pm2.keymetrics.io/docs/tutorials/pm2-nginx-production-setup

My Express Node.JS App times out

I have installed Node.js on my web server plus the dependencies for Express. When I run the command npm start and go to my web site's address using the port 3000 (which I believe the app is set to by default?), it just keeps loading and never loads. Any tipps please on how to fix this?
Try this $ PORT=8080 node app.js. Here app.js is your server config file. I suspect some background servers are running in that port 3000.

Meteor always listens on port 3000

I created a new Meteor project in WebStorm on Windows 8.
In "Run/Debug Configurations" I set the port value to 3008, but when I run the app, it always works on port 3000.
Does anybody know where Meteor defines the port number or how can I change it?
I've searched the words "3000", "PORT" and "listen" in the entire project but they don't exist.
I've also seen these questions which didn't help me because they use Express which defines the port number hard-coded:
Node.js/Express.js App Only Works on Port 3000 ,
Express is listening on port 3000 despite setting it to 80?
Any help will be profoundly appreciated!
Try passing -p 3008 as a program argument in Meteor run configuration:
http://localhost:3008 in Browser/Live Edit tab is just used for browser launching (i.e. it tells WebStorm to launch the browser with specified URL), it's not supposed to affect Meteor port in any way

Error: listen EADDRINUSE when trying to run an Express.js application?

When I try to run my application an Express.js server, the first time with a new port works fine, but then when I try to run it again on that port, I get the "Error: listen EADDRINUSE" error.
I already tried killing all the possible node/gulp processes, also, checked netstat and I do not see port 8080 being used by anything.
What could be the culprit?
This usually happens if the node process is still running your app when you go to run it again. Express will try to bind to the same port but it's already being use by the last node instance you created.
Kill all node processes and try again.
I know that this post is very old. But right now I saw something.
When I was in the same situation as you are in, I opened the console in my browser and I can see some errors. When I solved those errors, everything works fine.

Resources