Repository: nvm
Issue: reinstall-packages failed within nvm_cd
Labels: needs followup

<!-- Thank you for being interested in nvm! Please help us by filling out the following form if you‘re having trouble. If you have a feature request, or some other question, please feel free to clear out the form. Thanks! -->

#### Operating system and version:

macOS Big Sur v11.5.2

#### `nvm debug` output:
<details>
<!-- do not delete the following blank line -->

```sh
nvm --version: v0.38.0
$TERM_PROGRAM: Apple_Terminal
$SHELL: /bin/zsh
$SHLVL: 1
whoami: [EDITED]
${HOME}: /Users/[EDITED]
${NVM_DIR}: '${HOME}/.nvm'
${PATH}: ${NVM_DIR}/versions/node/v14.17.6/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/MacGPG2/bin:/Library/Apple/usr/bin
$PREFIX: ''
${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'zsh 5.8 (x86_64-apple-darwin20.0)'
uname -a: 'Darwin 20.6.0 Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:31 PDT 2021; root:xnu-7195.141.2~5/RELEASE_X86_64 x86_64'
checksum binary: 'shasum'
OS version: macOS 11.5.2 20G95
curl: /usr/bin/curl, curl 7.64.1 (x86_64-apple-darwin20.0) libcurl/7.64.1 (SecureTransport) LibreSSL/2.8.3 zlib/1.2.11 nghttp2/1.41.0
wget: /usr/local/bin/wget, GNU Wget 1.21.1 hecho en darwin20.4.0.
sed: /usr/bin/sed
cut: /usr/bin/cut
basename: /usr/bin/basename
rm: rm: aliased to rm -i (rm -i)
mkdir: /bin/mkdir
xargs: /usr/bin/xargs
git: /usr/bin/git, git version 2.30.1 (Apple Git-130)
ls: grep:: No such file or directory
grep: grep: aliased to grep --color (grep --color), grep (BSD grep) 2.5.1-FreeBSD
awk: /usr/bin/awk, awk version 20200816
nvm current: v14.17.6
which node: ${NVM_DIR}/versions/node/v14.17.6/bin/node
which iojs: iojs not found
which npm: ${NVM_DIR}/versions/node/v14.17.6/bin/npm
npm config get prefix: ${NVM_DIR}/versions/node/v14.17.6
npm root -g: ${NVM_DIR}/versions/node/v14.17.6/lib/node_modules
```
</details>

#### `nvm ls` output:
<details>
<!-- do not delete the following blank line -->

```sh
        v8.17.0
       v10.23.0
       v10.24.1
       v12.20.0
       v14.15.1
       v14.17.1
       v14.17.2
       v14.17.5
->     v14.17.6
default -> 14 (-> v14.17.6)
iojs -> N/A (default)
unstable -> N/A (default)
node -> stable (-> v14.17.6) (default)
stable -> 14.17 (-> v14.17.6) (default)
lts/* -> lts/fermium (-> v14.17.6)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0
lts/dubnium -> v10.24.1
lts/erbium -> v12.22.6 (-> N/A)
lts/fermium -> v14.17.6
```
</details>

#### How did you install `nvm`?
<!-- (e.g. install script in readme, Homebrew) -->

Homebrew

#### What steps did you perform?

```sh
nvm install 14 --reinstall-packages-from=node
```

#### What happened?

```sh
Downloading and installing node v14.17.6...
Downloading https://nodejs.org/dist/v14.17.6/node-v14.17.6-darwin-x64.tar.xz...
############################################################################################################################################################################## 100.0%
Computing checksum with shasum -a 256
Checksums matched!
Now using node v14.17.6 (npm v6.14.15)
VERSION=''
Reinstalling global packages from v14.17.5...
No installed global packages found...
Linking global packages from v14.17.5...
nvm_cd:cd:1: no such file or directory: /Users/[EDITED]/[VALID_LOCAL_PACKAGE_DIR]\n/Users/[EDITED]/[VALID_LOCAL_PACKAGE_DIR]
```

#### What did you expect to happen?

`reinstall-packages` to work instead of failing as shown above.

As you can see, it failed to parse/split the list of global packages as it is a single string with a `/n` instead of valid two paths.

#### Is there anything in any of your profile files that modifies the `PATH`?
<!--  (e.g. `.bashrc`, `.bash_profile`, `.zshrc`, etc) -->

No