Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Avsy/18515395d2690d04f4e01c57b5c3f8db to your computer and use it in GitHub Desktop.
Save Avsy/18515395d2690d04f4e01c57b5c3f8db to your computer and use it in GitHub Desktop.
Installing Node.js on GoDaddy Shared Hosting

Installation

Disclaimer: I take no responsiblity for any damages or any other liability. These are only the steps that I took, if you follow them, you do so at entirely your own risk.

Encountered a problem during the installation of Nodejs on my Godaddy Shared Linux Hosting

While setting up Node.js on Godaddy Shared Linux Hosting through SSH using PuTTy, I encountered some errors.

I executed the following command to install nvm:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash

NVM was successfully installed and confirmed by running nvm --version which returned '0.34.0'.

Next, I tried installing Node.js with the command nvm install node.

However, upon running this command, I faced the following errors:

...
nvm is not compatible with the npm config "prefix" option: currently set to ""
Run nvm use --delete-prefix v12.9.0 to unset it.

he expected outcome of nvm install node was a successful installation of Node.js along with its dependencies.

Upon checking the results in Putty, I observed:

nvm install node

Downloading and installing node v12.9.0...
...
nvm is not compatible with the npm config "prefix" option: currently set to ""
Run nvm use --delete-prefix v12.9.0 to unset it.

You can find more information on this topic in the blog post at .

I would appreciate any assistance with resolving these issues.

Step 1: Get Shell Access

First access you server’s shell through SSH. Instructions for cPanel are here. I’m on Windows 10, so I used PuTTY.

Step 2: Check for Previous Installs

By the time you’re reading this, GoDaddy may already install Node.js. So, lets make sure node, npm or nvm are not already installed. In the bash shell enter:

which node

which npm

which nvm

If they return nothing you’re good to carry on.

Step 3: Install Node Version Manager

Node Version Manager allows Node.js installation without the need for root access via the sudo.

I installed this in my home directory i.e. /home/username/ to get here you can enter. To install enter in bash:

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.0/install.sh | bash

Check the NVM GitHub page for instructions on installing a newer version

To make sure it’s installed enter

nvm --version

Step 4: Installing Node.js

Now we can get around to installing Node.js . To install the latest version enter in bash:

nvm install node

You can now set this as the default via bash:

nvm alias default node

To check that worked enter in bash:

node -v

npm -v

Both should return their versions. Before we get our hopes up, we’ll likely need to do some configuration.

Configuration

Once I’d finally got Node.js installed I encountered problems running NPM packages globally. The solution was to add some lines to environment variables.

Step 5: Check NPM Globals

The default location for global packages is home/yourusername/local/bin. You’ll be able to see where your global packages are installed. To check if that’s needed enter in bash:

npm list -g

If you’re receiving the message along the lines of not found in $PATH you will be unable to run global packages.

Step 6: Add to Bash Startup

To fix that add the following line to the file .bashrc which is located in your home directory (remember to alter it if your global package directory is different): export PATH="$PATH:$HOME/local/bin"

Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment