jorgebucaran / nvm.fish

The Node.js version manager you'll adore, crafted just for Fish
https://git.io/nvm.fish
MIT License
2.13k stars 71 forks source link

Invalid redirection target on latest nvm.fish and fish shell #164

Closed Murderlon closed 3 years ago

Murderlon commented 3 years ago

Hi, I'm on the latest fish shell (3.3.1) and I'm using fundle (latest) to install nvim.fish. The install is successful, and running nvm works as well. But doing any kind of nvm install will result in the following errors.

~/.config/fish/fundle/jorgebucaran/nvm.fish/functions/_nvm_index_update.fish (line 2): Invalid redirection target:
    if not command curl --location --silent $mirror/index.tab >$index.temp
                                                              ^
in function '_nvm_index_update'
    called on line 33 of file ~/.config/fish/fundle/jorgebucaran/nvm.fish/functions/nvm.fish
in function 'nvm' with arguments 'install latest'
~/.config/fish/fundle/jorgebucaran/nvm.fish/functions/_nvm_index_update.fish (line 13): Invalid redirection target:
    ' $index.temp >$index
                  ^
in function '_nvm_index_update'
    called on line 33 of file ~/.config/fish/fundle/jorgebucaran/nvm.fish/functions/nvm.fish
in function 'nvm' with arguments 'install latest'
~/.config/fish/fundle/jorgebucaran/nvm.fish/functions/nvm.fish (line 35): Invalid redirection target:
            string match --entire --regex -- (_nvm_version_match $v) <$nvm_data/.index | read v alias
                                                                     ^
in function 'nvm' with arguments 'install latest'
test: Missing argument at index 3
! -e
     ^
~/.config/fish/fundle/jorgebucaran/nvm.fish/functions/nvm.fish (line 42):
            if test ! -e $nvm_data/$v
               ^
in function 'nvm' with arguments 'install latest'
fish: Unknown command: node
~/.config/fish/fundle/jorgebucaran/nvm.fish/functions/nvm.fish (line 201):
    command node --eval "
        console.log(process.version)
        console.log('$npm_version_default' ? '$npm_version_default': require('$npm_path/package.json').version)
        console.log(process.execPath.replace(require('os').homedir(), '~'))
    "
    ^
in function '_nvm_node_info'
    called on line 1 of file ~/.config/fish/fundle/jorgebucaran/nvm.fish/functions/nvm.fish
in command substitution
    called on line 111 of file ~/.config/fish/fundle/jorgebucaran/nvm.fish/functions/nvm.fish
in function 'nvm' with arguments 'install latest'
Now using Node  (npm )
jorgebucaran commented 3 years ago

Can you repro with Fisher?

BarrensZeppelin commented 3 years ago

The problem is missing initialization of the nvm_mirror and nvm_data variables. I don't know enough about how fundle and fish plugins work, but I assume the function _nvm_install should be called automatically at some point in the process, but isn't. You can fix the problem by calling _nvm_install manually in the shell.

karolyi commented 5 months ago

Just FYI, this issue still happens with a new install.

jorgebucaran commented 5 months ago

What issue exactly? Are you using Fisher? I'm going to need a bit more info to get going.

karolyi commented 5 months ago

I've installed a brand new manjaro + fish-shell + fish-nvm (from AUR).

This constellation brought the error above.

jorgebucaran commented 5 months ago

nvm.fish should be installed and managed with Fisher, not AUR.

karolyi commented 5 months ago

Tell that to the guy who mainains the AUR repo :)

I'll touch base quickly with him and direct his attention to this issue.

jorgebucaran commented 5 months ago

Haha, yeah 🤦. I understand why you might have thought it would work–I didn't assume it was your fault. Part of the issue is that these packages are beyond my control. There was/is an AUR package for Fisher too, and it generally works well I hear, but there are issues with updating the environment within the same shell after installation. This is because AUR, being an executable, cannot directly modify the current Fish session. Fisher integrates seamlessly with Fish.

With nvm.fish, the problem is worse because Fisher not only does that, but also handles install, update, and uninstall events for plugins within the same session, which AUR cannot do as far as I know.

I'll touch base quickly with him and direct his attention to this issue.

Thanks! They should add a note at least.