Installing and using NODE.JS - not working?

software development

#1

Hi,

I’m trying to install NODE.JS from NodeJS.org and pretty much I have no idea what I’m doing with installing stuff or using it after it’s installed, I just know that I need to use NODE.JS for using WebSockets and has better scalability.

The code I have so far is this:

<?php echo "Running commands:</br>"; echo shell_exec('apt-get install python g++ make') . "<br/>"; echo shell_exec('mkdir ~/nodejs && cd $_') . "<br/>"; echo shell_exec('wget -N http://nodejs.org/dist/node-latest.tar.gz') . "<br/>"; echo shell_exec('tar xzvf node-latest.tar.gz && cd `ls -rd node-v*`') . "<br/>"; echo shell_exec('./configure') . "<br/>"; echo shell_exec('install') . "<br/>"; echo shell_exec('make install') . "<br/>"; echo shell_exec('make test') . "<br/>"; echo shell_exec('node helloworld.js') . "<br/>"; echo "Finished running commands."; ?>

Which outputs this:
http://pastebin.com/GxXhsuwG

Also here is my helloworld.js code:


#2

Just. Say. Node.

/inb4 Gnu meme

Your 1st apt-get has more socketry than Jim Hensen’s most debauched fantasies.


#3

Just saw this now…

Why on earth are you trying to run these shell commands all from PHP? If you switch your user account to be an SSH user, you can connect using an SSH client, which will give you a much better picture of what’s going on when you run all this.


#4

Oh I thought it was titled NodeJS, I’ll just say Node.

Well, as far as I know, I’m trying to use WebSockets on my web server, and I don’t know where to start. I searched around and saw “Node”, read about it, looked at an example of using it in html5, liked it. Now I think that it would be a good starting point, but I’m not sure.

Okay I didn’t know that. I’ll use an SSH program and do this, hopefully it’s not that complicated to use. I’ll post or update upon my attempts.


#5

It was a play on sounds. I was trying to hint that other options are available when dealing with sockets. If you’re using it for something basic (minimalist HTML5 chat is popular) then NodeJS is okay. If you’re building something large keep in mind that your code is calling other code that is piggy-backing other code (Google V8).


#6

Well I am going to have an html5 chat for reference, but I am planning to make a larger application. So should I be researching Google V8?


#7

V8 is a pretty cool guy. Eh was designed by engineers and doesn’t afraid of anything.

NodeJS is attached to it by programmers.