Open gabmontes opened 3 years ago
(note: nvm is unsupported when installed via homebrew, as the formula indicates; please brew uninstall it and install it properly with the install script from the readme)
What does npm ls -g --depth=0
print out?
Operating system and version:
macOS Big Sur v11.5.2
nvm debug
output:
nvm ls
output:How did you install
nvm
?Homebrew
What steps did you perform?
nvm install 14 --reinstall-packages-from=node
What happened?
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
?No
@Maciej93 what version of nvm are you using? If not the latest, please upgrade and try again.
@ljharb just tried again to go from v14.17.6 to v16 and had the same problem.
The problem happens with the packages that were npm link
'ed from local repositories. The ones installed globally from NPM were properly migrated.
Logs below:
$ nvm install 16 --reinstall-packages-from=node
Downloading and installing node v16.13.0...
Downloading https://nodejs.org/dist/v16.13.0/node-v16.13.0-darwin-x64.tar.xz...
############################################################################################################################################################################## 100.0%
Computing checksum with shasum -a 256
Checksums matched!
Now using node v16.13.0 (npm v8.1.0)
VERSION=''
Reinstalling global packages from v14.17.6...
[EDITED]
Linking global packages from v14.17.6...
nvm_cd:cd:1: no such file or directory: /Users/[EDITED]/[VALID_LOCAL_DIR_1]\n/Users/[EDITED]/[VALID_LOCAL_DIR_2]
$ npm ls -g --depth=0
/Users/[EDITED]/.nvm/versions/node/v16.13.0/lib
└── npm@8.1.0
$ nvm use 14
Now using node v14.17.6 (npm v6.14.15)
$ npm ls -g --depth=0
/Users/[EDITED]/.nvm/versions/node/v14.17.6/lib
├── [PACKAGE_NAME_1]@1.0.0 -> /Users/[EDITED]/[VALID_LOCAL_DIR_1]
├── [PACKAGE_NAME_2]@1.0.0 -> /Users/[EDITED]/[VALID_LOCAL_DIR_2]
└── npm@6.14.15
$ nvm --version
0.39.0
Hope this helps. If you need any more information, please let me know. Would be awesome if we can figure this out!
In node 14, what's the output of nvm_npm_global_modules
? Please try to redact as little as you can; specific characters might be important since we're doing string parsing.
@ljharb this is the output:
$ npm ls -g --depth=0
/Users/user/.nvm/versions/node/v14.17.6/lib
├── package-1@2.8.0 -> /Users/user/Documents/package-1
├── package-2@1.0.0 -> /Users/user/Documents/package-2
├── package-3@1.0.1 -> /Users/user/Documents/package-3
├── npm@6.14.15
└── peerflix@0.39.0
$ nvm_npm_global_modules
No .nvmrc file found
Please see `nvm --help` or https://github.com/nvm-sh/nvm#nvmrc for more information.
////
$ nvm_npm_global_modules 14
peerflix@0.39.0 //// /Users/user/Documents/package-1
/Users/user/Documents/package-2
/Users/user/Documents/package-3
It is edited but believe me, there are no special chars or anything weird.
What's the output of type -a cd
?
It is:
$ type -a cd
cd is a shell builtin
cd is /usr/bin/cd
aha, this is zsh - what's the output of setopt
? The stock setopt
on my zsh is:
combiningchars
interactive
monitor
shinstdin
zle
Yeah! I'm using zsh
as described in the output of nvm debug
😄
The output of setopt
on mine looks much larger:
$ setopt
alwaystoend
autocd
autopushd
combiningchars
completeinword
extendedhistory
noflowcontrol
histexpiredupsfirst
histignoredups
histignorespace
histverify
interactive
interactivecomments
login
longlistjobs
monitor
promptsubst
pushdignoredups
pushdminus
sharehistory
shinstdin
zle
Do you think any of these may be affecting nvm
? My zsh
is also almost stock. I only have some plugins enabled:
plugins=(common-aliases docker docker-compose git zsh-autosuggestions)
Absolutely it might be - what would be great is if you can binary search and try to figure out which option it is (or which plugin, but that's never been an issue before for nvm users).
Once we've narrowed it down, nvm can work around it so you don't have to keep that option disabled.
Operating system and version:
macOS Big Sur v11.5.2
nvm debug
output:nvm ls
output:How did you install
nvm
?Homebrew
What steps did you perform?
What happened?
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
?No