Thinking of building a Java-script application with a simple cPanel account?
Node.js, a server-side run-time environment comes handy here.
Even in a shared hosting environment, Node.js allows to create and host a wide variety of java-script web applications for specific needs. As it comes free, it gains popularity among website owners and developers.
At Bobcares, we often get requests from our customers to install node js using cPanel as part of our Server Management Services.
Today, we’ll see how our Support Engineers install node js via cPanel and fix the related errors.
Why Node.js ?
At this point, it’s worth checking on why to use Node.js for your applications.
The major benefits of Node.js include easy programming, option for adding additional resources at a later stage, etc.
Moreover, it allows the developer to write both the front-end as well as the back-end web application. Thus, it eliminates the need for a person to manage back-end applications.
How we install Node.js Application
We just saw too many reasons on why to have Node js. Luckily, Node js can work even in a simple cPanel shared account. This gives a room for web developers to begin with less resources, test it and scale up on a later stage.
Let’s see how our Support Engineers install node js on the cPanel server.
Requirements in Server
On the server side, Node.js requires programs like OpenSSL, Python2.6+, and a compiler like gcc. Therefore, we first check and confirm the availability of these programs. If found missing, we install them using commands:
yum install gcc-c++ yum install openssl-devel yum install python26
Further, we download and install the Node.js package. Then we compile the package and make it available for users.
Connecting as cPanel user
1. Initially, we log into the server via SSH as a cPanel user.
2. Then we create the application’s directory inside the home directory. To do this, run the following command:
3. And switch to the application’s directory using the command cd. Also, we create the app.js file with a text editor
4. We add the application’s configuration to the app.js file.
5. After that, we test the application by using the following command.
6. Once we install the application, we register it via cPanel >> Home >> Software >> Application Manager.
7. After you register the application, we can access the application with the following URL,
8. Finally, we touch the restart.txt touch file each time that we want mod_passenger to restart the application.
This is how we set up Node.js Application on a server.
Common errors with Node.js and fixes
Its time now to see how things go wrong with Node.js install in cPanel servers. We’ll take a look at the top reasons and how our Dedicated Engineers solve it.
1. Mismatch in GLIBC version
Recently, one of our customers had an error while installing Node Js on the Cpanel server. He got an error like,
./node: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.10' not found (required by ./node) ./node: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.11' not found (required by ./node) ./node: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.3' not found (required by ./node) ./node: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.9' not found (required by ./node) ./node: /lib64/libc.so.6: version `GLIBC_2.7' not found (required by ./node)
On checking, we found that the issue was related to current GLIBC version on the server. Upgrading the standard glibc library can be risky, as some programs and libraries may depend on the existing version. Therefore, To avoid disturbing current environment, our Dedicated Engineers compiled and installed newer glibc version. Then we installed Nodejs separately by configuring the new glibc prefix.
2. Memory limitations
Sometimes, customers may experience errors after installing Node Js on the server. It can happen due to memory limitation in cPanel servers or because of user memory boundaries in CloudLinux.
For example, one of our customers had an error while installing nodejs on the server. The error said,
ENOMEM: not enough memory, scandir '/home/cpXXXX/nodevenv/nodejs2/6/lib/node_modules/.staging/util-deprecate-0920d04d'
The error clearly showed memory restrictions. So, our Support Engineers solved this problem by increasing the memory limits for the cPanel account. For servers running CloudLinux, we make necessary changes in the LVE panel too.
[Having trouble while installing Node Js in cPanel server? We’ll fix it for you.]
In short, Node.js is used to create and host a wide variety of web applications to meet your needs. Today, we saw how our Support Engineers install node js using cPanel and fix the related errors.