Schniz / fnm

šŸš€ Fast and simple Node.js version manager, built in Rust
https://fnm.vercel.app
GNU General Public License v3.0
16.45k stars 419 forks source link

Issues in fish shell #356

Open gf3 opened 3 years ago

gf3 commented 3 years ago
fnm 1.22.8
fish, version 3.1.2

this is how i'm configuring fnm:

if type -q fnm
  fnm env --shell fish --use-on-cd | source
  fnm completions --shell fish | source
end

i get the following errors indeterminately when starting a new shell:

2021-01-05T13:16:04,155070927-05:00

2021-01-05T13:17:39,683836653-05:00

Schniz commented 3 years ago

Interesting. Sorry about that. Do you know which command fails? fnm env or fnm completions?

gf3 commented 3 years ago

@Schniz hi gal, thanks for the reply. i'm almost certain that it's the first line (fnm env) as i only added the second line recently and it has been happening for a little bit. please let me know if there's anything else i can do to help debug

Schniz commented 3 years ago

It would be best if you can create a repo with a failing GitHub action. Because Iā€™m kinda afk at the moment and it could help me debug šŸ˜„

Schniz commented 3 years ago

hey, any update? šŸ˜„

gf3 commented 3 years ago

@Schniz unfortunately i haven't had any additional time to dig into this

gf3 commented 3 years ago

i haven't been able to create an environment in which i can reproduct, however i just had another big crash after node process ran out of heap memory in a docker container:

freshline-backend          |
freshline-backend          | <--- Last few GCs --->
freshline-backend          |
freshline-backend          | [50:0x56430cb830c0]  2159687 ms: Mark-sweep (reduce) 2044.0 (2054.9) -> 2043.2 (2055.2) MB, 1898.5 / 0.0 ms  (averagemu = 0.161, current mu = 0.014) allocation failure scavenge might not succeed
freshline-backend          | [50:0x56430cb830c0]  2163033 ms: Mark-sweep (reduce) 2044.3 (2052.2) -> 2043.6 (2053.2) MB, 3336.9 / 0.0 ms  (averagemu = 0.069, current mu = 0.002) allocation failure scavenge might not succeed
freshline-backend          |
freshline-backend          |
freshline-backend          | <--- JS stacktrace --->
freshline-backend          |
freshline-backend          | FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: process ID out of range

Usage:
 ps [options]

 Try 'ps --help <simple|list|output|threads|misc|all>'
  or 'ps --help <s|l|o|t|m|a>'
 for additional help text.

For more details see ps(1).
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', library/std/src/io/stdio.rs:1021:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:495:5
   1: std::panicking::begin_panic_fmt
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:437:5
   2: std::io::stdio::print_to
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/io/stdio.rs:1021:9
   3: std::io::stdio::_print
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/io/stdio.rs:1033:5
   4: fnm::commands::command::Command::call
   5: fnm::cli::SubCommand::call
   6: fnm::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: process ID out of range

Usage:
 ps [options]

 Try 'ps --help <simple|list|output|threads|misc|all>'
  or 'ps --help <s|l|o|t|m|a>'
 for additional help text.

For more details see ps(1).
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', library/std/src/io/stdio.rs:1021:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:495:5
   1: std::panicking::begin_panic_fmt
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:437:5
   2: std::io::stdio::print_to
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/io/stdio.rs:1021:9
   3: std::io::stdio::_print
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/io/stdio.rs:1033:5
   4: fnm::commands::command::Command::call
   5: fnm::cli::SubCommand::call
   6: fnm::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: process ID out of range

Usage:
 ps [options]

 Try 'ps --help <simple|list|output|threads|misc|all>'
  or 'ps --help <s|l|o|t|m|a>'
 for additional help text.

For more details see ps(1).
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', library/std/src/io/stdio.rs:1021:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:495:5
   1: std::panicking::begin_panic_fmt
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:437:5
   2: std::io::stdio::print_to
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/io/stdio.rs:1021:9
   3: std::io::stdio::_print
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/io/stdio.rs:1033:5
   4: fnm::commands::command::Command::call
   5: fnm::cli::SubCommand::call
   6: fnm::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: process ID out of range

Usage:
 ps [options]

 Try 'ps --help <simple|list|output|threads|misc|all>'
  or 'ps --help <s|l|o|t|m|a>'
 for additional help text.

For more details see ps(1).
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: process ID out of range

Usage:
 ps [options]

 Try 'ps --help <simple|list|output|threads|misc|all>'
  or 'ps --help <s|l|o|t|m|a>'
 for additional help text.

For more details see ps(1).
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: process ID out of range

Usage:
 ps [options]

 Try 'ps --help <simple|list|output|threads|misc|all>'
  or 'ps --help <s|l|o|t|m|a>'
 for additional help text.

For more details see ps(1).
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', library/std/src/io/stdio.rs:1021:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:495:5
   1: std::panicking::begin_panic_fmt
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:437:5
   2: std::io::stdio::print_to
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/io/stdio.rs:1021:9
   3: std::io::stdio::_print
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/io/stdio.rs:1033:5
   4: fnm::commands::command::Command::call
   5: fnm::cli::SubCommand::call
   6: fnm::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: process ID out of range

Usage:
 ps [options]

 Try 'ps --help <simple|list|output|threads|misc|all>'
  or 'ps --help <s|l|o|t|m|a>'
 for additional help text.

For more details see ps(1).
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', library/std/src/io/stdio.rs:1021:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:495:5
   1: std::panicking::begin_panic_fmt
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/panicking.rs:437:5
   2: std::io::stdio::print_to
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/io/stdio.rs:1021:9
   3: std::io::stdio::_print
             at /rustc/e1884a8e3c3e813aada8254edfa120e85bf5ffca/library/std/src/io/stdio.rs:1033:5
   4: fnm::commands::command::Command::call
   5: fnm::cli::SubCommand::call
   6: fnm::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
error: Can't infer shell!
fnm can't infer your shell based on the process tree.
Maybe it is unsupported? we support the following shells:
* bash
* zsh
* fish
* powershell
~/C/g/f/arowana mainā€¢ 36m 55.2s ā±
gf3 commented 3 years ago
fnm 1.22.9
fish, version 3.2.1
Schniz commented 3 years ago

I can't really help if I can't reproduce. Feel free to compile from source and try to add println šŸ˜’

What I really don't understand is why we get "can't infer shell", if you provide the shell explicitly. šŸ¤Ø

Schniz commented 3 years ago

If you have ideas and you aren't sure how to encode it in Rust, I'd be glad to help

lkonya commented 3 years ago

I'm using fish as well, but it works for me (although just set it up a couple of minutes ago) Just copy-pasted @gf3's config into ~/.config/fish/conf.d/fnm.fish

fish, version 3.2.2
fnm 1.24.0
macOS 11.2.1
Schniz commented 3 years ago
fnm 1.22.9
fish, version 3.2.1

Oh, try to upgrade. Not sure it will work.

I'm using fish as well, but it works for me (although just set it up a couple of minutes ago)

There might be something else that is configured in the shell that makes it harder to use. Not sure and can't really debug that remotely. I regularly do shell-configuration-debugging for coworkers šŸ˜ƒ

brandonpittman commented 2 years ago

Everyone having trouble here, and now meā€¦seem to be using the Hydro prompt.

Schniz commented 2 years ago

Everyone having trouble here, and now meā€¦seem to be using the Hydro prompt.

What does it mean? How can I reproduce?

brandonpittman commented 2 years ago

@Schniz I just installed the Hydro prompt and started getting this problem too. By the looks of other people's screenshots, they're using the same prompt. Something weird must be going on in the prompt. I took a quick look in the source code of the prompt, but didn't notice anything. But this error most certainly started after switching to Hydro.

jorgebucaran commented 2 years ago

@gf3 @brandonpittman Run your configuration only if Fish is interactive:

if type fnm && status is-interactive
  fnm env --shell fish --use-on-cd | source
  fnm completions --shell fish | source
end
brandonpittman commented 2 years ago

@jorgebucaran

Thanks, but per your comment in the hydro repo, I switched to nvm.fish! šŸ˜†

gf3 commented 2 years ago

@jorgebucaran i have also stopped using fnm for the time being

MauricioRobayo commented 2 years ago

I'm using Tide and got similar error unless I run the configuration only if Fish is interactive. This is the error:

thread 'main' panicked at 'Can't write output: Os { code: 32, kind: BrokenPipe, message: "Broken pipe" }', src/commands/use.rs:56:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
stack backtrace ``` 0: 0x560f54e1cd40 - std::backtrace_rs::backtrace::libunwind::trace::h5e9d00f0cdf4f57e at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5 1: 0x560f54e1cd40 - std::backtrace_rs::backtrace::trace_unsynchronized::hd5302bd66215dab9 at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5 2: 0x560f54e1cd40 - std::sys_common::backtrace::_print_fmt::ha0237cd11a34e2bf at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/sys_common/backtrace.rs:67:5 3: 0x560f54e1cd40 - ::fmt::h171d4c10df1a98ee at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/sys_common/backtrace.rs:46:22 4: 0x560f54e4193c - core::fmt::write::h89e4288724daa3fa at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/core/src/fmt/mod.rs:1096:17 5: 0x560f54e15d22 - std::io::Write::write_fmt::h6d40f996e84584d9 at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/io/mod.rs:1568:15 6: 0x560f54e1f4b5 - std::sys_common::backtrace::_print::h0c0b93221682afc8 at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/sys_common/backtrace.rs:49:5 7: 0x560f54e1f4b5 - std::sys_common::backtrace::print::h57a9f95204c2fdd6 at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/sys_common/backtrace.rs:36:9 8: 0x560f54e1f4b5 - std::panicking::default_hook::{{closure}}::h4245258b50e37e69 at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panicking.rs:208:50 9: 0x560f54e1f013 - std::panicking::default_hook::h7b00dcc1d0944747 at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panicking.rs:225:9 10: 0x560f54e1fc51 - std::panicking::rust_panic_with_hook::h71e6a073d87de1f5 at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panicking.rs:591:17 11: 0x560f54e1f797 - std::panicking::begin_panic_handler::{{closure}}::hd549436f6bb6dbb8 at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panicking.rs:497:13 12: 0x560f54e1d1dc - std::sys_common::backtrace::__rust_end_short_backtrace::h4e5f4b72b04174c3 at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/sys_common/backtrace.rs:141:18 13: 0x560f54e1f6f9 - rust_begin_unwind at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panicking.rs:493:5 14: 0x560f54e40051 - core::panicking::panic_fmt::hcd56f7f635f62c74 at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/core/src/panicking.rs:92:14 15: 0x560f54e3fe73 - core::option::expect_none_failed::hf37eebedadde29e6 at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/core/src/option.rs:1300:5 16: 0x560f54ab5540 - ::apply::h4df50cefb64cfe1a 17: 0x560f54ab366a - fnm::commands::command::Command::call::ha5210a9105c2b129 18: 0x560f54aa8eea - fnm::cli::SubCommand::call::h5db7e95919c84a74 19: 0x560f54abf8eb - fnm::main::h13c54bc16211e7aa 20: 0x560f54a96fc3 - std::sys_common::backtrace::__rust_begin_short_backtrace::h08a2fe9ad119ae69 21: 0x560f54a96fd9 - std::rt::lang_start::{{closure}}::hdb1d45bf8f06377d 22: 0x560f54e20077 - core::ops::function::impls:: for &F>::call_once::h527fb2333ede305e at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/core/src/ops/function.rs:259:13 23: 0x560f54e20077 - std::panicking::try::do_call::h309d8aee8149866c at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panicking.rs:379:40 24: 0x560f54e20077 - std::panicking::try::h75a60c31fd16bfc6 at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panicking.rs:343:19 25: 0x560f54e20077 - std::panic::catch_unwind::h1f9892423e99bc00 at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/panic.rs:431:14 26: 0x560f54e20077 - std::rt::lang_start_internal::hd5b67df56ca01dae at /rustc/2fd73fabe469357a12c2c974c140f67e7cdd76d0/library/std/src/rt.rs:51:25 27: 0x560f54abfed2 - main 28: 0x7fbd8ca9bb25 - __libc_start_main 29: 0x560f54a82e5a - _start 30: 0x0 - ```

Update 1

The offending command is fnm env --shell fish --use-on-cd | source. Using it without the --use-on-cd or running it only if Fish is interactive works fine, so my guess is that it is something related to the _fnm_autoload_hook when it is non interactive:

function _fnm_autoload_hook --on-variable PWD --description 'Change Node version on directory change'
    status --is-command-substitution; and return
    if test -f .node-version -o -f .nvmrc
        fnm use
    end
end

_fnm_autoload_hook

fish version: 3.3.1 fnm version: 1.27.0 OS: Linux

Update 2

I noticed the OP was running fnm v1.22.8, so I installed v1.22.7 from the releases, the error goes away using that version (v1.22.7).

Schniz commented 2 years ago

Woah @MauricioRobayo I just saw your edits. Looks pretty good. Very weird that v1.22.7 does work and v1.22.8 does not, as there is not much difference between them šŸ¤” can you confirm that it is still the case?

trm217 commented 2 years ago

For the meantime I fixed the issue with a slight adaptation of the configuration shared by @jorgebucaran. (I added the -q flag to prevent the path to fnm being written into the console when running the type command)

if type fnm -q && status is-interactive 
  fnm env --shell fish --use-on-cd | source
  fnm completions --shell fish | source
end
jasonkuhrt commented 2 years ago

I'm having this issue. Was working. Noticed today the problem. Not sure what changed.

woeps commented 2 years ago

Same issue here. My setup:

when I cd into a dir containing a node version config I get:

thread 'main' panicked at 'Can't write output: Os { code: 32, kind: BrokenPipe, message: "Broken pipe" }', src/commands/use.rs:92:13

Not sure, how to debug further from here, since I'm note really familiar with rust (yet ;) ). Any ideas how I could find the reasons for this behaviour?
I'd like to find out why this is happening instead of deactivating it on non-interactive sessions.

ubmit commented 1 year ago

Getting the same error when I cd into a node repository. That's strange because it started happening today šŸ¤”

thread 'main' panicked at 'Can't write output: Os { code: 32, kind: BrokenPipe, message: "Broken pipe" }', src/commands/use.rs:92:13

macOS 12.6 (M1 Pro) fnm 1.31.1 fish, version 3.5.1 tide, version 5.5.1

Edit: uninstalled the tide prompt and I'm not facing the issue anymore

woeps commented 1 year ago

This comment in another repos's issue seems to solve it. :tada:

Change ~/.config/fish/conf.d/fnm.fish to:

status is-interactive && fnm env --use-on-cd | source

Note: I have absolutely no clue what status is-interactive actually does. But this solved the issue for me and I'm now using fnm happily on fish + tide again. :smile: