Tuesday, September 10, 2013

Cloud9IDE node app Not Starting

ERROR in Cloud9IDE
throw er; // Unhandled 'error' event                                                                                                                                                
              ^ 
Error: you may be using the wrong PORT & HOST for your server app 
Node: use 'process.env.PORT' as the port and 'process.env.IP' as the host in your scripts. 

PROBLEM
Node app is running through another console session.  When attempting to start your new node app session, cloud9 errors about port/host.

SOLUTION 1:  Logout of Cloud9 Session through bottom Console twice

exit
exit

SOLUTION 2:  Find Node Process ID & Kill it

1. top to show processes
2. k to trigger Kill
3. Open up node app in another tab while watching for the node process to jump to top in top processes.  Mine was 23682 (your's will be different).
4. 23682
5. 15 to confirm killing
6. Go back to node directory & node app 

SOLUTION 3:  Find Node Process ID & Kill it
(this one's more difficult to find the node-openshift process)

netstat -lpn

find node process:
tcp        0      0 127.3.221.129:8080          0.0.0.0:*                   LISTEN      23682/node-openshif

kill -15 23682


FULL ERROR THAT CAUSED POST
events.js:72                                                                                                                                                                                
        throw er; // Unhandled 'error' event                                                                                                                                                
              ^                                                                                                                                                                             
                                                                                                                                                                                            
                                                                                                                                                                                            
 Cloud9  Error: you may be using the wrong PORT & HOST for your server app                                                                                                                  
         Node: use 'process.env.PORT' as the port and 'process.env.IP' as the host in your scripts. See also https://c9.io/site/blog/2013/05/can-i-use-cloud9-to-do-x/                      
Error: listen EADDRINUSE                                                                                                                                                                    
    at errnoException (net.js:906:11)                                                                                                                                                       
    at Server._listen2 (net.js:1044:14)                                                                                                                                                     
    at listen (net.js:1066:10)                                                                                                                                                              
    at Server.listen (net.js:1132:5)                                                                                                                                                        
    at Object. (/var/lib/stickshift/521509f54382ec067d000240/app-root/data/590355/platform/app.js:55:24)                                                                         
    at Module._compile (module.js:456:26)                                                                                                                                                   
    at Object.Module._extensions..js (module.js:474:10)                                                                                                                                     
    at Module.load (module.js:356:32)                                                                                                                                                       
    at Function.Module._load (module.js:312:12)                                                                                                                                             
    at Function.Module.runMain (module.js:497:10)       

3 comments:

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from Node JS Online Training from India . or learn thru Javascript Online Training from India. Nowadays JavaScript has tons of job opportunities on various vertical industry. ES6 Online Training

    ReplyDelete