I only following the following installation instructions
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash
and after restarting Terminal, I get this:
-bash: /Users/allantatter/.nvm/nvm.sh: line 110: syntax error near unexpected token `done'
-bash: /Users/allantatter/.nvm/nvm.sh: line 110: ` done'
Any ideas? I have been stuck with the problem more than a hour, haven't found a solution online yet..
The part of ~/.nvm/nvm.sh file where the syntax error is thrown:
nvm_tree_contains_path() {
local tree
tree="$1"
local node_path
node_path="$2"
if [ "@$tree@" = "@@" ] || [ "@$node_path@" = "@@" ]; then
>&2 echo "both the tree and the node path are required"
return 2
fi
local pathdir
pathdir=$(dirname "$node_path")
while [ "$pathdir" != "" ] && [ "$pathdir" != "." ] && [ "$pathdir" != "/" ] && [ "$pathdir" != "$tree" ]; do
pathdir=$(dirname "$pathdir")
done
[ "$pathdir" = "$tree" ]
}
Can you try reinstalling again? I also use bash, and it doesn't have a syntax error for me - so I'm hoping it's a fluke. (also, that function hasn't changed in a long time)
I've already tried to reinstall it multiple times, directly with curl/wget and also brew install nvm.
Definitely don't use brew, nvm is completely unsupported on homebrew.
You're seeing the syntax error with v0.29.0 - what happens if you install v0.28.0? (curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.28.0/install.sh | bash)
If that's still not working, what's alias curl and alias bash say?
I tried different versions, even v0.17.0, same thing.
$ alias bash
-bash: alias: bash: not found
$ alias curl
-bash: alias: curl: not found
Can you gist your bashrc or bash_profile contents? It's likely a syntax error in your actual profile files, that nvm is just exposing.
Yup, you were right :) I have been starting to create very short aliases lately to speed up my workflow and didn't notice I had made alias do='/**/' which clearly could break things. I bet this is not the last alias I will have to struggle with.
Thanks @ljharb for your help!
Thanks for confirming!
The same problem for me as for @allantatter! I've added alias to connect to digital ocean cloud, like alias do="ssh ...". After removing this line problem had resolved
Most helpful comment
Yup, you were right :) I have been starting to create very short aliases lately to speed up my workflow and didn't notice I had made
alias do='/**/'which clearly could break things. I bet this is not the last alias I will have to struggle with.Thanks @ljharb for your help!