Oct 11, 2013

controldeck.js on Mac Os

Disclaimer: this post might not be the better solution, probably there are other solutions over the net.

My intention was to give a try to controldeck.js. The reason is that this kind of presentations blow my mind.
Well is not all straightforward.
Dependencies!
You need dependecies to be able to run controldeck.js.
Eaaaaasy i thought, there only two: node-static and socket.io... and also node js...
I already had node js so i only needed node-static and socket.io...
How can i can install node packages modules? with npm.
I tried npm in my console and surprisingly was already installed in my system!
The way that you install node pkg modules is running npm install package.
So I tried npm install node-static and an error appeared (same error also for socket.io).
 TypeError Arguments to path.resolve must be strings
Reading and trying lot of things (most of them without knowing what they were really doing) i found a post that said to delete node js and reinstall it using nvm (node version manager).
Why not?
First, you must delete node js from the system, so i followed this post.
Yes, its tedious but in this way i also discovered that i had two differents versions of node js in my system. Probably that was the reason why i couldn't install node-static and socket.io. After deleting all node's and node_modules, i installed nvm running in my console.
I installed nvm running:
curl https://raw.github.com/creationix/nvm/master/install.sh | sh
Later, installed node js with nvm and worked! (checkout the usage section to do this)
To be sure if it was installed correctly type node -v in the console.
At this moment i was like the beginning, with node js installed (more than one version installed but working...).
I tried  in the console npm install static-node and worked!!
Then i also tried npm install socket.io... worked too!!
Finally i run node app.js  from controldeck.js folder and opened the url http://localhost:8080 in a browser.
Controldeck.js was running...

No comments: