swc: cargo install swc_cli fails with error

Describe the bug

Executing:

cargo install swc_cli

fails with:

   Compiling swc_ecma_transforms_proposal v0.80.0
error[E0599]: no method named `class_private_field_init` found for reference `&Helpers` in the current scope
   --> /Users/josh/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_ecma_transforms_compat-0.73.1/src/es2022/class_properties/mod.rs:593:45
    |
593 | ...                   callee: helper!(class_private_field_init, "classPrivateFieldInit"),
    |                                       ^^^^^^^^^^^^^^^^^^^^^^^^ help: there is an associated function with a similar name: `class_private_field_get`

error[E0599]: no method named `class_private_method_init` found for reference `&Helpers` in the current scope
   --> /Users/josh/.cargo/registry/src/github.com-1ecc6299db9ec823/swc_ecma_transforms_compat-0.73.1/src/es2022/class_properties/mod.rs:736:45
    |
736 | ...                   callee: helper!(class_private_method_init, "classPrivateMethodInit"),
    |                                       ^^^^^^^^^^^^^^^^^^^^^^^^^ help: there is an associated function with a similar name: `class_private_method_get`

For more information about this error, try `rustc --explain E0599`.
error: could not compile `swc_ecma_transforms_compat` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error: failed to compile `swc_cli v0.6.0`, intermediate artifacts can be found at `/var/folders/q5/j_5ly6wx1x3frg2k_jcdmk500000gn/T/cargo-installQvm4UI`

Caused by:
  build failed

Input code

No response

Config

No response

Playground link

No response

Expected behavior

The installation should succeed.

Actual behavior

No response

Version

0.8.0

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

@joshcartme mind try cargo install swc_cli --locked?

For the workaround, mind try

npm install @swc/core@latest
npx swcx ...

to see if it works? looks like there’s some pkg collision.