Reputation: 2625
I run gulp for my mean-io stack application.
I get the below error.
13:15:54] Starting 'server'...
13:15:54] Finished 'server' after 47 ms
13:15:54] Live reload server listening on: 35729
.. Uhoh. Got error listen EADDRINUSE ...
rror: listen EADDRINUSE
at errnoException (net.js:901:11)
at Server._listen2 (net.js:1039:14)
at listen (net.js:1061:10)
at Server.listen (net.js:1127:5)
I guess the port 35729 is being used by some other application. Am I right? I have also tried changing the port number in livereload.js. But then, I got the same error.
The below are the files where, I see the 35729 port number assigned. Please let me know if should change the port number any where.
myApp\node_modules\grunt-contrib-watch\node_modules\tiny-lr-fork\lib\public\livereload.js:
321: this.port = 35829;
myApp\node_modules\grunt-contrib-watch\node_modules\tiny-lr-fork\lib\server.js
20: options.port = parseInt(options.port || 35729, 10);
myApp\node_modules\grunt-contrib-watch\node_modules\tiny-lr-fork\node_modules\noptify\index.js:
21: // .option('port', '-p', 'Port to listen on (default: 35729)', Number)
myApp\node_modules\grunt-contrib-watch\node_modules\tiny-lr-fork\bin\tiny-lr:
14: .option('port', '-p', 'Port to listen on (default: 35729)', Number)
18: opts.port = opts.port || 35729;
Thanks.
Upvotes: 1
Views: 5660
Reputation: 3154
I had the same issue on Windows, you can use netstat -aon
to see what port is in use (ie listening, established). This also provides the process ID of each item listed.
In the screenshot below the port is used (or listened on) by a process with PID 10968.
Open up your Task Manager, then go to the Details tab and look for that same PID. Click on End Task and then restart your app using npm start
.
It should launch.
Upvotes: 0
Reputation: 2625
I made a change in gulpexpress/index.js
, port number changed to 35829. And it worked.
It seems same port number 35729 is used more than once for two different process.
Upvotes: 0
Reputation: 147
Port 35729
used by (gulp-express) tiny-lr
livereload server. You need to disable tiny-lr
livereload server.
Instead of
server.run(['app.js']);
You can do this when starting server:
server.run(['app.js'], {}, false|35729|{});
false
mean that tiny-lr
livereload server disabled.
Upvotes: 1
Reputation: 2987
When working with gulp
, I've found that sometimes terminating my process will fail to close a connection on the livereload
port 35729. This leaves an open file descriptor listening on that port, which will make it hard to start my server up again, because gulp
will complain as soon as it starts up livereload
.
Sometimes you don't know the name of the process that owns the connection, so it's hard to find and kill. To list files opened by processors that are listening on a port using TCP, you can use the lsof -n -i4TCP:#####
command. In this case, you get:
$ lsof -n -i4TCP:35729
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
node 15723 testuser 24u IPv6 0x71823b3990749ea5 0t0 TCP *:35729 (LISTEN)
Now you have the PID of the process that's listening on the port you're trying to access, so you can kill this with
$ kill -9 15723
and now running gulp
should work just fine :)
Upvotes: 10