Running Node.JS on Tizen 2.0
Connecting to the SDP.
sdb -d shell
" to connect directly to the h/w, and to remain in the interactive shell. Its a fairly standard linux prompt, but its missing command completion, and the cursor escape sequences are not enabled by default. Feel free to play around in this console, "cat /proc/cpuinfo
" is interesting to try, especially if you compare it with the same command typed into the sdb shell when you are connected to the emulator. Another fun command to try is "/usr/bin/xeyes
".CPUINFO FOR THE RD_PQ SDP. Four cores at 1.6Ghz

CPUINFO FOR THE EMULATED SDP. A Pentium 4 at 1.5Ghz

Download your rpm file
sdb -d push nodejs-0.6.14-slp.1.1.armv7l.rpm /
sdb -d shell rpm -i nodejs-0.6.14-slp.1.1.armv7l.rpm.

Create a webserver
Copy the following code into a file called hello-world.js : its from an example in Learning Node by Shelley Powers
// load http module
var http = require('http');
// create http server
http.createServer(function (req, res) {
// content header
res.writeHead(200, {'content-type': 'text/plain'});
// write message and signal communication is complete
res.end("Hello, Tizen World!\n");
}).listen(8088);
console.log('Server running on 8088');
"C:\tizen-sdk\tools>sdb -d push hello-world.js /
"
Remember to add the trailing / as that is the destination directory. The attachment hello-http.zip contains the webserver javascript file.
sdb -d shell
" and find the phone's IP address using ifconfig, and run the webserver by typing "node hello-world.js
" . The console log message " Server running on 8088
" will be printed when it starts. Note that the webserver port is not 8080, the regular node example port, because there is something running on that port already. At least there was on my phone.Start up your browser and point it to your specific inet addr
field, highlighted in the picture above, for the wlan0
interface and you will see the following message.
At this point node.js is working, but a few more tweaks are neccesary to get npm, the node package manager working. The sudo package is not installed, and npm command lines use that for installation, and also to find a users home directory. A quick fix is to set the $HOME envireonment variable to point to a writeable directory, in my instance I used /home/tizenapp
. That allowed me to install "less
" and "coffee-script
". Both seem functional, but there's a problem with the coffeescript repl, that I plan to work on.
Next Steps
I want to get sudo installed, and I want to get a newer version of Node.js installed. At the time of writing this article version 0.8.19 is running on my windows bx and version 10.x is public. I also need to upgrade my SDP to version 2.2 of Tizen, and that's a good place to close this article. If you remember, I found this node.js rpm while I was looking for the 2.2 flash images.
I've also got node running on the Tizen Emulator, although I had to install a different binary as the emulator is not the ARM hardware in the phone but is emulating a Pentium class IA Processor. Ping me on twitter @intel_stewart or @tizenapp if you want more info on that version.
Attachment | Size |
---|---|
![]() | 349 bytes |
Comments
BY Raghu Kona,
Thanks Stewart. Nice article.