Here is the Rust version
% cargo --version
cargo 1.75.0 (1d8b05cdd 2023-11-20)
When I use cargo to install swc_cli
cargo install swc_cli
Cargo install swc_cli not working with the following error:
error[E0277]: `Resolution` doesn't implement `std::fmt::Display`
--> /Users/chenwenl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc_ecma_transforms_module-0.178.19/src/path.rs:239:33
|
239 | info!("Resolved to {}", target);
| ^^^^^^ `Resolution` cannot be formatted with the default formatter
|
= help: the trait `std::fmt::Display` is not implemented for `Resolution`
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
= note: this error originates in the macro `::core::format_args` which comes from the expansion of the macro `info` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types
--> /Users/chenwenl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc_ecma_transforms_module-0.178.19/src/path.rs:242:13
|
241 | let mut target = match target {
| ------ this expression has type `Resolution`
242 | FileName::Real(v) => {
| ^^^^^^^^^^^^^^^^^ expected `Resolution`, found `FileName`
|
help: you might have meant to use field `filename` whose type is `FileName`
|
241 | let mut target = match target.filename {
| ~~~~~~~~~~~~~~~
error[E0308]: mismatched types
--> /Users/chenwenl/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc_ecma_transforms_module-0.178.19/src/path.rs:250:13
|
241 | let mut target = match target {
| ------ this expression has type `Resolution`
...
250 | FileName::Custom(s) => return Ok(self.to_specifier(s.into(), orig_filename)),
| ^^^^^^^^^^^^^^^^^^^ expected `Resolution`, found `FileName`
|
help: you might have meant to use field `filename` whose type is `FileName`
|
241 | let mut target = match target.filename {
| ~~~~~~~~~~~~~~~
Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `swc_ecma_transforms_module` (lib) due to 5 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `swc_cli v0.91.141`, intermediate artifacts can be found at `/var/folders/ht/ywtww6wd2p91hy7g1kxgtd900000gn/T/cargo-installevoHBf`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
How can I solve this problem?
I've tried reinstalling Rust, but it did not help.