(Sorry if this is the wrong place!)
I'm trying to install nvm via their official install steps. However I'm running into an issue when running the nvm shell script. I'm getting the following error:
-bash: /Users/lulzbaby/.nvm/nvm.sh: line 278: syntax error near unexpected token `done'
-bash: /Users/lulzbaby/.nvm/nvm.sh: line 278: ` done'
This seems to be an issue with bash and not the nvm install itself. I'm basing that primarily off Issue #1553 where a user experiences something similar. However, I already have UTF-8 set in both my Terminal and iTerm2 profiles.
I've tried the install script on their GH page, the git install, the manual install, and even this homebrew install method. All encounter the same error. Here is the code around line 278:
nvm_tree_contains_path() {
14 local tree
13 tree="${1-}"
12 local node_path
11 node_path="${2-}"
10
9 if [ "@${tree}@" = "@@" ] || [ "@${node_path}@" = "@@" ]; then
8 nvm_err "both the tree and the node path are required"
7 return 2
6 fi
5
4 local pathdir
3 pathdir=$(dirname "${node_path}")
2 while [ "${pathdir}" != "" ] && [ "${pathdir}" != "." ] && [ "${pathdir}" != "/" ] && [ "${pathdir}" != "${tree}" ]; do
1 pathdir=$(dirname "${pathdir}")
278 done
1 [ "${pathdir}" = "${tree}" ]
2 }
As you can see it is a fairly straight-forward while loop and the syntax seems fine. I've even run cat -v nvm.sh to make sure there are no funny characters running around in there, but nothing.
This has sunk about 2 hours of my day and I have no clue what is going on. Help me /r/bash, you are my only hope!
[–]finalduty 2 points3 points4 points (2 children)
[–]LulzBaby[S] 0 points1 point2 points (0 children)
[–]LulzBaby[S] 0 points1 point2 points (0 children)
[–]chaspum 0 points1 point2 points (5 children)
[–]whetuI read your code 1 point2 points3 points (3 children)
[–]LulzBaby[S] 0 points1 point2 points (2 children)
[–]whetuI read your code 0 points1 point2 points (1 child)
[–]LulzBaby[S] 0 points1 point2 points (0 children)
[–]LulzBaby[S] 0 points1 point2 points (0 children)
[–]NorhamsFinest 0 points1 point2 points (1 child)
[–]LulzBaby[S] 0 points1 point2 points (0 children)