Installing Node Version Manager (NVM) on DH Shared server?

In the DH Knowledge Base, there is an article that suggests node.js and NVM can be installed on a shared server account. (See: )

Either of the two install methods (curl or wget) work as expected.
My “problem” is that I can’t seem to get the bash environment correctly configured.

I log in via Putty and thus have “ssh command line” access. But not sure how to execute the bit about adding “nvm” to the bash environment.

I haven’t done much real work in *NIX “shell” for at least 20 years…so you with younger/more nimble minds…PLEASE HELP!

San Antonio, TX

Note: You may need to turn on Show Hidden Files in your SFTP client in order to see the following two files. Alternatively you can edit them directly in shell using your editor of choice (e.g. vim or nano) if you’re comfortable doing so.

The installer should automatically add the following necessary arguments to your (hidden) .bashrc file:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/" ] && \. "$NVM_DIR/"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

…which tells the server where to find everything. Take a look in there to see if those lines were inserted correctly.

In order for you to also use your custom node directly within a login shell just type

. .bashrc

upon logging in. (that’s dot-space-dot-bashrc).

If you think you’ll be using it a lot in shell you can add the . .bashrc dotted command to your (also hidden) .bash_profile file so that it sources the paths automatically whenever you login to shell.


That’s very helpful! Thanks.

When I added “. .bashrc” to the .bash_profile and then logged out and back in, the process sorta “hung”.

That doesn’t seem to be the way I would have expected it to work!

Can you elaborate more on which process seemed unresponsive?

1 Like

After adding “. .bashrc” to the end of the .bash_profile (using “vi”),
I logged out of the Putty session and then logged back in.

Normally when I put the password in, the login is “almost instantly” at the $ prompt.
But with “. .bashrc” in the .bash_profile, the login process seems to “hang”…so I just cancelled with CTRL-C and removed the line from the .bash_profile.

I just looked at your link to the Knowledge Base and it does mention that some servers might have a security feature that you may need get around.

In shell:

$ setfattr -n user.pax.flags -v "mr" $NVM_DIR/

Worth a shot!

I think the slow loading could be due to a (seemingly inconsistent) bug that has been in npm for years. Someone recently bumped the issue to everyone’s attention again. From reading the history it appears to raise issue on Ubuntu machines but is somewhat erratic in nature.

Original issue notice:

Recent bump:

I can’t reproduce the problem on the shared server I’m on, but I’d suggest anyone encountering this issue try to nvm install a different version of node to see if you get lucky and load up a non-problematic npm with the node engine.


This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.