Closed j-xella closed 3 weeks ago
I don't use plugins this way and don't use NU_PLUGIN_DIRS at all. I always keep the plugins in ~/.cargo/bin regardless of operating system and since ~/.cargo/bin is in my path they are easily found and plugin add/rm work fine.
I can reproduce this with 0.94.2
and no additional $env.NU_PLUGIN_DIRS
dir values.
bin\nu_plugin_gstat.exe
into Roaming\nushell\plugins\
plugin add nu_plugin_qstat
The trace says found but then errors with not found.
> nu -c '$env.NU_PLUGIN_DIRS' took 4s
╭───┬──────────────────────────────────────────────╮
│ 0 │ C:\Users\<redacted>\AppData\Roaming\nushell\plugins │
╰───┴──────────────────────────────────────────────╯
> nu --log-level trace -c 'plugin add nu_plugin_qstat'
2024-06-05 12:16:26.977 PM [TRACE] nu_parser::parser: [crates\nu-parser\src\parser.rs:2214] -- found nu_plugin_qstat
Error: nu::shell::io_error
× I/O error
╭─[source:1:12]
1 │ plugin add nu_plugin_qstat
· ───────┬───────
· ╰── The system cannot find the file specified. (os error 2)
╰────
Did this work before, until now? I have not been using official or plugin-dir plugins until now.
Commit d717e8faeb5a7e842b47de20fe573ba05a628f26 changed the default env.nu (in file version 0.87.2
)
Dropping
# FIXME: This default is not implemented in rust code as of 2023-09-06.
The trace says found even if no such plugin file exists
> nu --log-level trace -c 'plugin add nu_plugin_qstatss'
2024-06-05 12:28:46.429 PM [TRACE] nu_parser::parser: [crates\nu-parser\src\parser.rs:2214] -- found nu_plugin_qstatss
Error: nu::shell::io_error
× I/O error
╭─[source:1:12]
1 │ plugin add nu_plugin_qstatss
· ────────┬────────
· ╰── The system cannot find the file specified. (os error 2)
╰────
/cc @devyn for his thoughts
I have my .\cargo\bin
folder in both PATH and NU_PLUGIN_DIRS. The plugin is installed via cargo install
and work fine if I supply the absolute path to plugin add
. However, without path, the command returns os error 2
. I also have to supply the .exe
extension since I'm on Windows.
The outcome remains same when I try to load my plugin from Roaming\nushell\plugins
, but when I run nushell with --log-level trace
, I also get this ...\nu-parser-0.98.0\src\parser.rs:2391] -- found nu_plugin_...
message.
I've never tried plugin add file
. I've always provided the full path to the plugin file, with the extension.
I tried and it doesn't work for me either. nu_plugin_polars is in ~/.cargo/bin already. Seems like a bug.
❯ $env.NU_PLUGIN_DIRS
╭───┬────────────────────────────────────────────────────────────╮
│ 0 │ /Users/fdncred/Library/Application Support/nushell/plugins │
│ 1 │ /Users/fdncred/.cargo/bin │
╰───┴────────────────────────────────────────────────────────────╯
❯ plugin add nu_plugin_polars
Error: nu::shell::io_error
× I/O error
╭─[entry #2:1:12]
1 │ plugin add nu_plugin_polars
· ────────┬───────
· ╰── No such file or directory (os error 2)
╰────
The problem is that locate_in_dirs()
is not finding the plugin.
https://github.com/nushell/nushell/blob/6e1e824473e15eba246e1c43704c5d88fa237a17/crates/nu-cmd-plugin/src/commands/plugin/add.rs#L87-L90
I think I fixed it https://github.com/nushell/nushell/pull/13877
Describe the bug
It seems that the latest version of nu shell ignores NU_PLUGIN_DIRS variable
How to reproduce
Expected behavior
As per documentation:
Screenshots
No response
Configuration
Additional context
No response