SharpWebStudio : An ISO 9001:2008 certified company
Select Page

Before starting this, let us point you to this page which covers a good list of servers and how you can install NodeJS on your own server. The instructions/details below are specific to few common problems that came during setting up of of development servers on few of our projects.

1.)  apt-get command not found

OR

1.) Running "sudo rpm --import https://fedoraproject.org/static/0608B895.txt" gives
 you "error: https://fedoraproject.org/static/0608B895.txt: import read failed(-1)."

Quick Fix : Use “wget” instead:

wget http://nodejs.org/dist/node-latest.tar.gz
tar-zxvf [node-version.tar.gz]
cd [node-v0.10.18]

The above commands will download the latest version of Node, unzip it and change the directory for you.

2.) After doing the above, run “./configure” in the Node directory. The Configure command might throw an error like below :

File "./configure", line 433
    fpu = 'vfpv3' if armv7 else 'vfpv2'
                   ^
SyntaxError: invalid syntax

This is perhaps due to the version of Python your host is using. Try installing Python latest version of Python.

The key however, is not to screw up the current Python version your host is using. So we use “altinstall” to avoid changing the system version of Python because it will break the system, like below:

wget http://python.org/ftp/python/2.7.6/Python-2.7.6.tar.xz
tar xf Python-2.7.6.tar.xz
cd Python-2.7.6
./configure
make && make altinstall

Once you have done this, you can then run “python2.7 ./configure” in your NodeJS folder to compile it successfully.

3.) Once you have solved the above, you can go ahead and run in your NodeJS folder:

make sudo make install

to install the NodeJS.

4.) Test it by quickly running the command:

node --version

to check for the installed version of NodeJS.

5.) When you are developing, you would want the Node server to keep running as a service, otherwise when you close the SSH terminal or Putty, you will find that the Node server also shuts down. You can use “Forever” to run your NodeJS server forever regardless of closing the connection to the SSH.

npm install forever -g

-g tells npm to install it globally

Run your NodeJS script/server using:

forever start hello.js

Lastly, if you are looking for a beginner’s approach to NodeJS development, head on to NodeBiginner for getting your hands dirty with NodeJS.

Keep Progrocking!!