Node and NVM install broken on Ubuntu 14. Any ideas what I should do?

which node

returns

/usr/sbin/node

which nvm

returns nothing

nvm ls returns nothing

express no longer works

If I try curl https://raw.githubusercontent.com/creationix/nvm/v0.11.1/install.sh | bash

It says

nvm is already installed in /home/adam/.nvm, trying to update => HEAD is now at 7a423b7... v0.11.1 error: branch 'master' not found.

and it is true that .nvm is located there.

Any idea what I should do to either uninstall everything and reinstall it or fix my install?

I fixed this by deleting everything (purge Ubuntu packages and delete everything created by node and npm in /usr/*) and compiling the node package from their website.

I copied the commands from https://www.digitalocean.com/community/tutorials/how-to-install-an-upstream-version-of-node-js-on-ubuntu-12-04 instead of linking, in case the site goes offline:

echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install
curl -L https://npmjs.org/install.sh | sh
node -v

The unofficial install scripts are buggy and it's about time they make an official repository or pre-compile some .deb files to make the installation easier. Hope this helps.

The problem is that apt-get install nodejs installs node as "nodejs" on your path. Grunt, express, etc. all expect node to be node on your path. The reason for this is there was a package named node already in the Ubuntu apt repository before node.js came into existence, so node.js couldn't claim "node". The simplest solution is to do which nodejs then create a symlink targeting that file, name it node, and put that on your path (you can just put it in the same directory).

For you I recommend uninstalling everything first (apt-get remove).