How to Install Latest Node.js v22.2.0 on cPanel shared hosting (without root/sudo)
Hendra ~ Dec 23, 2024 224

How to Install Latest Node.js v22.2.0 on cPanel shared hosting (without root/sudo)

Technology

Recently, I secured an affordable web hosting service; however, it did not come with pre-installed development tools such as Node.js and NPM, which are essential for my projects. Fortunately, I discovered an insightful article by Simon East on Medium that provided the perfect solution to this issue., check it here

Here's the guide that i get :

# Requirements :

  • SSH Access for command line in the hosting. I have test this on niagahoster premium web hosting, so i think this will work on others with similiar services. 
  • SSH Client like terminal or putty

# And Heres the command :

# Make a new folder for node
mkdir node
cd node

# Download and unzip node
# You can choose the version in this repository, in this guide i choose node v.22.2.0

curl -O https://nodejs.org/dist/latest/node-v22.2.0-linux-x64.tar.gz
tar -xvzf node-v22.2.0-linux-x64.tar.gz --strip-components=1

# Add node and npm it to PATH (and do so for future sessions too)

export PATH=$HOME/node/bin:$PATH
echo 'export PATH=$HOME/node/bin:$PATH' >> ~/.bashrc

# Test the Node and NPM to check if its run properly.

# Checking the version

node -v

npm -v

# Conclusion

The setup works well for me; however, I need to conduct further tests involving tasks such as compiling assets or installing node module dependencies. I plan to share the results and additional insights at a later time. 

The initial configuration of my development environment has proven to be effective, but it's crucial to verify its reliability through more complex tasks such as compiling assets and installing node module dependencies. These tests are essential to ensure that the environment can handle real-world development scenarios efficiently. Successful completion of these tasks will confirm the robustness of my setup, allowing me to move forward with confidence. Once I have these results, I'll share a detailed review and practical tips based on my experiences. This information could be invaluable for others in the developer community who might be considering a similar setup or facing comparable challenges.

Related Articles

Configure Laravel Apps on Shared Hosting and Fix The Image or File storage in public_html Directory

Hendra ~ Dec 23, 2024

When deploying a Laravel application to a shared hosting environment, especially when you need to serve images or other assets stored in Laravel's...

Technology
Configure Laravel Apps on Shared Hosting and Fix The Image or File storage in public_html Directory