Cannot get new release of `nu` using Cargo

I can't install nu 0.63.0 using Cargo. cargo search sees the latest release, but cargo install (even with --force or a specific version string) is unable to find it.

❯ cargo search nu --limit 1
nu = "0.63.0"    # A new type of shell
... and 388 crates more (use --limit N to see more)

❯ cargo install --version 0.63.0 nu
    Updating index
error: could not find `nu` in registry `crates-io` with version `=0.63.0`

❯ cargo uninstall nu
    Removing /home/batmanaod/.cargo/bin/nu

❯ cargo install nu
    Updating index
  Downloaded nu v0.61.0

The above is after running cargo cache autoclean and cargo cache -r registry-sources,registry-crate-cache,registry-index,registry.


❯ cargo version
cargo 1.59.0 (49d8809dc 2022-02-10)

How about cargo install nu?

That's the last command in the code block I showed. As you can see, it downloads and installs v0.61.0.

Well, I am stumped. Because cargo install nu install 0.63.0 for me...

As am I!

Another debugging step worth checking is manually deleting the cargo cache directory to see if that fixes it. (If it does, recording what the cache autoclean leaves behind would be useful for a bug report that autoclean isn't cleaning enough.)

1 Like

Which directory exactly? .cargo/registry?

Here's what I get if I hide .package-cache:

~ on ☁️  (us-west-1)
❯ mv .cargo/.package-cache{,-hide}

❯ cargo install nu
    Updating index
  Downloaded nu v0.61.0
  Downloaded 1 crate (1.5 MB) in 0.44s
     Ignored package `nu v0.61.0` is already installed, use --force to override

Note that the cache was rebuilt, but I didn't copy the progress bar before it was overwritten.

It looks like your copy of crates-io registry is out of date.

Run cargo update (you may need to create a project with cargo new for it to work). If all else fails, delete ~/.cargo/registry directory and try again.

cargo update did not change the behavior, nor did renaming .cargo/registry to .cargo/registry.hide. Several of the commands I've run have shown a progress bar for updating the registry. I haven't included that in my code-blocks because the output gets hidden once the operation completes, but here's what I get after hiding the .cargo/registry folder:

❯ cargo install nu --version 0.63.0
    Updating index
       Fetch [==>                      ]  14.48%, 2.11MiB/s
error: could not find `nu` in registry `crates-io` with version `=0.63.0`

The truly weird part here is that, as I showed in my first post, cargo search nu does show version 0.63.0.

Updating Rust from 1.59.0 to the latest version (1.61.0) fixed this. I have no idea why.

Current version of nushell has rust-version = "1.60" in its Cargo.toml. That is, minimal supported version is 1.60. Therefore, Cargo shipped with Rust 1.59 ignored incompatible release and fetched the last compatible one. Looks like a bug in cargo search, then?


Also that's a poor error, since the crate is in the registry, just ignored because of the min-rust key. (I thought all that we did currently was error when trying to build!)


I think the error message is poor enough to consider this a bug, maybe.

I don't think I'd consider it a bug in search, since it makes sense that search would simply show what's available, whether or not you can actually build it with your current toolset.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.