Skip to content

error[E0463]: can't find crate for thiserror_impl #3328

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
SamuelLarkin opened this issue Apr 30, 2024 · 6 comments
Closed

error[E0463]: can't find crate for thiserror_impl #3328

SamuelLarkin opened this issue Apr 30, 2024 · 6 comments
Labels

Comments

@SamuelLarkin
Copy link

Problem

From README, it says to install

cargo install tree-sitter-cli

but I get a compilation error

error[E0463]: can't find crate for `thiserror_impl`
   --> $HOME/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thiserror-1.0.59/src/lib.rs:248:9
    |
248 | pub use thiserror_impl::*;
    |         ^^^^^^^^^^^^^^ can't find crate

For more information about this error, try `rustc --explain E0463`.
error: could not compile `thiserror` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `tree-sitter-cli v0.22.5`, intermediate artifacts can be found at `/tmp/cargo-installDzduiT`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

Steps to reproduce

cargo install tree-sitter-cli

Expected behavior

tree-sitter installs.

Tree-sitter version (tree-sitter --version)

tree-sitter-cli v0.22.5

Operating system/version

Linux

@WillLillis
Copy link
Member

Sometimes cargo's index can get corrupted, leading to these kinds of issues (e.g. this stackoverflow post). If you delete the ~/.cargo/registry/index directory, does the installation still fail?

@amaanq
Copy link
Member

amaanq commented May 1, 2024

Yeah I just built it fine locally on macos and on linux, using stable and nightly, it's not an issue here I'd think

I would try @WillLillis's suggestion first and see if that works

@amaanq amaanq closed this as not planned Won't fix, can't repro, duplicate, stale May 1, 2024
@SamuelLarkin
Copy link
Author

SamuelLarkin commented May 6, 2024

I still get the error even after deleting the registry.

rm -fr ~/.cargo/registry
cargo --version
cargo 1.76.0 (c84b36747 2024-01-18)
error[E0463]: can't find crate for `thiserror_impl`
   --> /home/larkins/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thiserror-1.0.59/src/lib.rs:248:9
    |
248 | pub use thiserror_impl::*;
    |         ^^^^^^^^^^^^^^ can't find crate

For more information about this error, try `rustc --explain E0463`.
error: could not compile `thiserror` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `tree-sitter-cli v0.22.6`, intermediate artifacts can be found at `/tmp/cargo-installfiA527`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

@SamuelLarkin
Copy link
Author

Tried a new version of cargo

error[E0463]: can't find crate for `thiserror_impl`
   --> /home/larkins/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thiserror-1.0.59/src/lib.rs:248:9
    |
248 | pub use thiserror_impl::*;
    |         ^^^^^^^^^^^^^^ can't find crate

For more information about this error, try `rustc --explain E0463`.
error: could not compile `thiserror` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `tree-sitter-cli v0.22.6`, intermediate artifacts can be found at `/tmp/cargo-installPOUNjD`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
cargo --version
cargo 1.78.0 (54d8815d0 2024-03-26)

@SamuelLarkin
Copy link
Author

rm -fr ~/.cargo/registry
rustup run  nightly-x86_64-unknown-linux-gnu cargo install tree-sitter-cli
error[E0463]: can't find crate for `thiserror_impl`
   --> /home/larkins/.cargo/registry/src/index.crates.io-6f17d22bba15001f/thiserror-1.0.59/src/lib.rs:248:9
    |
248 | pub use thiserror_impl::*;
    |         ^^^^^^^^^^^^^^ can't find crate

For more information about this error, try `rustc --explain E0463`.
error: could not compile `thiserror` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `tree-sitter-cli v0.22.6`, intermediate artifacts can be found at `/tmp/cargo-installlVsZn4`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

@WillLillis
Copy link
Member

I updated to cargo 1.78.0 and wasn't able to replicate the issue:

image

I found a similar looking issue in cargo's repo, but with llvm_sys instead of thiserror_impl. A comment on the issue indicates that reinstalling Ubuntu and rust (and rebuilding llvm) somehow fixed the problem, although that seems fairly extreme. The maintainers may have a better idea of what could be causing this, but I don't see how this could be on tree-sitter's end. Maybe it's worth filing an issue upstream?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants