I just set up the same thing in my environment.
I used -L rather than -f to test existence -- since I'm looking for a symlink.
I also noticed that the symlink path suggested in the blog post was incorrect. See correction below.
[ -L $HOME/bin/karma ] || ln -s /scratch/jenkins/addons/node/$node_name/lib/node_modules/karma/bin/karma $HOME/bin/karma