解决安装 tauri-cli 遇到: `there is a method with a similar name: to_cow_str` 的问题

815 阅读1分钟

cargo install tauri-cli 安装 tauri-cli v1.5.10 时会遇到: there is a method with a similar name: to_cow_str 的问题,如下所示

error[E0599]: no method named `to_str` found for struct `log::kv::Value` in the current scope
   --> /Users/jane/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tauri-cli-1.5.10/src/lib.rs:132:29
    |
132 |         let action = action.to_str().unwrap();
    |                             ^^^^^^ help: there is a method with a similar name: `to_cow_str`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `tauri-cli` (lib) due to previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `tauri-cli v1.5.10`, intermediate artifacts can be found at `/var/folders/5w/4f5ls3qd1jx_3g46f5n6z1dh0000gn/T/cargo-install61VX9a`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

可以通过添加 --locked 来解决这个问题,即通过 cargo install tauri-cli --locked 来安装。

参考: github.com/tauri-apps/…