Cloud9 + sails.js + phpmyadmin - node.js

I have problem with creating basic sails.js application on Cloud9 environment and connecting it to MySQL.
Steps I'm making:
Creating Cloud9 project
installing sails: npm -g install sails
creating project: sails new test
lifting: cd testProject/ and sails lift
Here it's working
Adding mySQL support: mysql-ctl start
still working
adding phpMyAdmin support: phpmyadmin-ctl install
And here, my application stops working. I'm getting exception:
events.js:72
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE
at errnoException (net.js:905:11)
at Server._listen2 (net.js:1043:14)
at listen (net.js:1065:10)
at Server.listen (net.js:1139:5)
at Array.async.auto.start [as 0] (/home/ubuntu/.nvm/v0.10.35/lib/node_modules/sails/lib/hooks/http/start.js:29:35)
at /home/ubuntu/.nvm/v0.10.35/lib/node_modules/sails/node_modules/async/lib/async.js:484:38
at _each (/home/ubuntu/.nvm/v0.10.35/lib/node_modules/sails/node_modules/async/lib/async.js:46:13)
at Object.async.auto (/home/ubuntu/.nvm/v0.10.35/lib/node_modules/sails/node_modules/async/lib/async.js:455:9)
at Sails.startServer (/home/ubuntu/.nvm/v0.10.35/lib/node_modules/sails/lib/hooks/http/start.js:16:11)
at Sails.emit (events.js:92:17)
at Sails.emitter.emit (/home/ubuntu/.nvm/v0.10.35/lib/node_modules/sails/lib/app/private/after.js:50:11)
at afterBootstrap (/home/ubuntu/.nvm/v0.10.35/lib/node_modules/sails/lib/app/private/initialize.js:56:11)
at bootstrapDone (/home/ubuntu/.nvm/v0.10.35/lib/node_modules/sails/lib/app/private/bootstrap.js:51:14)
at Object.module.exports.bootstrap (/home/ubuntu/workspace/testProject/config/bootstrap.js:16:3)
at Sails.runBootstrap (/home/ubuntu/.nvm/v0.10.35/lib/node_modules/sails/lib/app/private/bootstrap.js:44:25)
at Sails.bound [as runBootstrap] (/home/ubuntu/.nvm/v0.10.35/lib/node_modules/sails/node_modules/lodash/dist/lodash.js:729:21)
at Sails.initialize (/home/ubuntu/.nvm/v0.10.35/lib/node_modules/sails/lib/app/private/initialize.js:48:9)
at bound (/home/ubuntu/.nvm/v0.10.35/lib/node_modules/sails/node_modules/lodash/dist/lodash.js:729:21)
at /home/ubuntu/.nvm/v0.10.35/lib/node_modules/sails/node_modules/async/lib/async.js:607:21
at /home/ubuntu/.nvm/v0.10.35/lib/node_modules/sails/node_modules/async/lib/async.js:246:17
at iterate (/home/ubuntu/.nvm/v0.10.35/lib/node_modules/sails/node_modules/async/lib/async.js:146:13)
at /home/ubuntu/.nvm/v0.10.35/lib/node_modules/sails/node_modules/async/lib/async.js:157:25
at /home/ubuntu/.nvm/v0.10.35/lib/node_modules/sails/node_modules/async/lib/async.js:248:21
at /home/ubuntu/.nvm/v0.10.35/lib/node_modules/sails/node_modules/async/lib/async.js:612:34
at /home/ubuntu/.nvm/v0.10.35/lib/node_modules/sails/lib/app/load.js:201:13
at /home/ubuntu/.nvm/v0.10.35/lib/node_modules/sails/node_modules/async/lib/async.js:451:17
at /home/ubuntu/.nvm/v0.10.35/lib/node_modules/sails/node_modules/async/lib/async.js:441:17
at _each (/home/ubuntu/.nvm/v0.10.35/lib/node_modules/sails/node_modules/async/lib/async.js:46:13)
at Object.taskComplete (/home/ubuntu/.nvm/v0.10.35/lib/node_modules/sails/node_modules/async/lib/async.js:440:13)
at processImmediate [as _immediateCallback] (timers.js:354:15)
Additionally I'm getting info about problem with starting my app, and ability to kill the process. Of course killing does not help.
Could youplease help me with that?

So what's happening is that you're starting your sails server, which binds to port 8080, and then you try to install phpmyadmin which tries to start apache (at port 8080 too!) causing it to actually fail since the port is already in use. You will have to stop sails before trying to install / run phpmyadmin since two servers can't listen on the same port.

Related

Openshift redis cartridge with strange exceptions ETIMEDOUT on socket.io script

I have a socket.io node script running that acts as a chat server. I had it running on a local server ok, and have since tried moving it over to openshift.
I used the following cartridge to get it working - https://github.com/smarterclayton/openshift-redis-cart/issues
While running the local version of the server, while connecting to the openshift redis, I get strange timeouts exactly 127 seconds after I run the script.
events.js:72
throw er; // Unhandled 'error' event
^
Error: Redis connection to <server> failed - connect ETIMEDOUT
at RedisClient.on_error (/path/node_modules/redis/index.js:196:24)
at Socket.<anonymous> (/path/node_modules/redis/index.js:106:14)
at Socket.emit (events.js:95:17)
at net.js:441:14
at process._tickCallback (node.js:442:13)
I have seen the events.js:72 one before, but its usually when I try to run a node script with something already running on that port.
Pretty sure the script itself is fine, as when I swap out the redis server for my local one, it will sit there for days and work fine.
So my question: why is my socket.io script killing itself after exactly 127 seconds when redis is hosted on openshift?
Are you using the rhc port-forward command so that you can connect to redis on OpenShift? Otherwise that port is not publicly available.

light streamer nodejs hello world example throwing error

hello every one i am new in nodejs and want to use the light streamer for my site there is a example on git when i tried to deployed it on my local instance throwing the below error any idea will be appreciated thanks in advance...
here is the example i want to deploy
Light streamer nodjs example
E:\wamp\www\nodeJs\lightstream>node helloworld.js
events.js:85
throw er; // Unhandled 'error' event
^
Error: connect ECONNREFUSED
at exports._errnoException (util.js:746:11)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1000:19)
ECONNREFUSED suggests that the application is not able to connect to the desired TCP port (most likely it is being blocked by a firewall or there is no application listening on that port).
Assuming you have not changed the configuration in helloworld.js:
Have you installed the lightstream server locally and checked it is running? If so, check Windows Firewall and add rules to allow inbound ports 6663 and 6664.

npm start giving error

I have installed KrakenJs on Windows 7. I have created project by using following command :
Yo Kraken
When I tried to run the project, it is giving following error (even after restarting system) :
E:\nodejs\test\kraken\Dust-01>npm start
> dust-01#0.1.0 start E:\nodejs\test\kraken\Dust-01
> node index.js
Error: listen EACCES
at errnoException (net.js:901:11)
at Server._listen2 (net.js:1020:19)
at listen (net.js:1061:10)
at Server.listen (net.js:1127:5)
at bind (E:\nodejs\test\kraken\Dust-01\node_modules\kraken-js\index.js:139:33)
at _fulfilled (E:\nodejs\test\kraken\Dust-01\node_modules\kraken-js\node_modules\q\q.js:798:54)
at self.promiseDispatch.done (E:\nodejs\test\kraken\Dust-01\node_modules\kraken-js\node_modules\
q\q.js:827:30)
at Promise.promise.promiseDispatch (E:\nodejs\test\kraken\Dust-01\node_modules\kraken-js\node_mo
dules\q\q.js:760:13)
at E:\nodejs\test\kraken\Dust-01\node_modules\kraken-js\node_modules\q\q.js:574:44
at flush (E:\nodejs\test\kraken\Dust-01\node_modules\kraken-js\node_modules\q\q.js:108:17)
E:\nodejs\test\kraken\Dust-01>
Can some one guide me what I am doing wrong and how it can be rectified
Look into next two possibilities:
Try opening your command prompt 'As Administrator', that shall solve the issue if you are lacking permissions to open port.
Temporarily change the port used in Kraken to something irregular and long, example: 32482
Then move on from this, if 1st - then you have solved an issue, if 2nd - you are very likely trying to open a port, which is already used by other application.

error when starting the server with grunt or node server

I am trying to use the mean stack as described here : http://mean.io/
after install, when making "grunt", there is an error :
debugger listening on port 5858
4 Jan 01:47:40 - [nodemon] reading ignore list
Express app started on port 3000
events.js:72
throw er; // Unhandled 'error' event
^
Error: failed to connect to [localhost:27017]
at null.<anonymous> (/mean/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:540:74)
at EventEmitter.emit (events.js:106:17)
at null.<anonymous> (/mean/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:140:15)
at EventEmitter.emit (events.js:98:17)
at Socket.<anonymous> (/mean/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:478:10)
at Socket.EventEmitter.emit (events.js:95:17)
at net.js:441:14
at process._tickCallback (node.js:415:13)
4 Jan 01:47:40 - [nodemon] app crashed - waiting for file changes before starting...
I tried the troubleshooting as specified on the site : Updating Grunt, bower and cleaning npm and bower caches worked well. but updating npm gives an error too:
npm ERR! error rolling back Error: Refusing to delete: /usr/local/bin/npm not in /usr/local/lib/node_modules/npm
This looks like a conflict between homebrew and npm.
but anyway i have version 1.3.21 installed.
There is the same error when i am trying node server.
do you have an idea on what i can do to make the server work ?
It may be too easy, but seems like your MongoDB server is not actually running. After having installed Mongo (on your Mac, I assume?), you have to open a Terminal window/tab, run mongod and leave it running (or use screen, etc.). You can try to access MongoDB CLI by typing mongo to make sure the server is running.
#desgnl: if you don't want to run mongod command everytime you are running the grunt, you can always use third party services like MongoDB Hosting: Database-as-a-Service by MongoLab https://mongolab.com Hope this helps too!

Unhandled error event in node.js and express app

I was following along to this tutorial on "Authentication Using PassportJS" at this blog
And downloaded the files from his repo at https://github.com/DanialK/PassportJS-Authentication . And I intalled the packages that the terminal instructed me to. Then I attempted to run the app again but got this
connect.multipart() will be removed in connect 3.0
visit https://github.com/senchalabs/connect/wiki/Connect-3.0 for alternatives
connect.limit() will be removed in connect 3.0
Express server listening on port 3000
events.js:66
throw arguments[1]; // Unhandled 'error' event
^
Error: failed to connect to [localhost:27017]
at Server.connect.connectionPool.on.server._serverState (/Users/juangallardo/Desktop/PassportJS-Authentication-master/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:540:74)
at EventEmitter.emit (events.js:115:20)
at connection.on._self._poolState (/Users/juangallardo/Desktop/PassportJS-Authentication-master/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:140:15)
at EventEmitter.emit (events.js:91:17)
at Socket.errorHandler (/Users/juangallardo/Desktop/PassportJS-Authentication-master/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:478:10)
at Socket.EventEmitter.emit (events.js:88:17)
at Socket._destroy.self.errorEmitted (net.js:335:14)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
The problem was that I did not have MongoDB running
I found that "issue" discussed on GitHub
Then got the instructions to install and run mongo from this tutorial
brew install mongodb
Then you simply start the mongo server from the terminal with
mongod
Then back in your project just start the app with
node app.js

Resources