未能在Mac M1上遵循紫杉教程 - 使用未宣布的类型`vec'

发布于 2025-02-04 15:02:51 字数 525 浏览 5 评论 0原文

每当我运行中继构建货物运行-target = wasm32 inscornown-innown innown我都会遇到一堆示波器错误。

我已经运行Rustup Target添加WASM32-INGNOWN INKNOWNcargo install-locked wasm-bindgen-cli,但仍然没有运气。

这些错误消息是什么意思?

[编辑] 输出很长,但是它是这样开始的:

[2m2022-06-06T01:51:52.351114Z[0m [32m INFO[0m 
              

Whenever I run trunk build or cargo run --target=wasm32-unknown-unknown I get a bunch of scope errors.

enter image description here

I've already run rustup target add wasm32-unknown-unknown and cargo install --locked wasm-bindgen-cli, but still had no luck.

What do these error messages mean?

[Edit]
The output is pretty long, but it starts like this:

[2m2022-06-06T01:51:52.351114Z[0m [32m INFO[0m ???? starting build
[2m2022-06-06T01:51:52.351741Z[0m [32m INFO[0m spawning asset pipelines
[2m2022-06-06T01:51:52.390738Z[0m [32m INFO[0m building yew-app
   Compiling ryu v1.0.10
   Compiling itoa v1.0.2
   Compiling cfg-if v1.0.0
   Compiling hashbrown v0.11.2
   Compiling slab v0.4.6
   Compiling scoped-tls-hkt v0.1.2
   Compiling serde v1.0.137
   Compiling thiserror v1.0.31
error[E0463]: can't find crate for `core`
  |
  = note: the `wasm32-unknown-unknown` target may not be installed
  = help: consider downloading the target with `rustup target add wasm32-unknown-unknown`

error[E0463]: can't find crate for `compiler_builtins`

For more information about this error, try `rustc --explain E0463`.
error: could not compile `cfg-if` due to 2 previous errors
warning: build failed, waiting for other jobs to finish...
error[E0463]: can't find crate for `core`
  --> /Users/patrickstivalchaerke/.cargo/registry/src/github.com-1ecc6299db9ec823/itoa-1.0.2/src/lib.rs:44:5
   |
44 | use core::mem::{self, MaybeUninit};
   |     ^^^^ can't find crate
   |
   = note: the `wasm32-unknown-unknown` target may not be installed
   = help: consider downloading the target with `rustup target add wasm32-unknown-unknown`

error[E0463]: can't find crate for `std`
  |
  = note: the `wasm32-unknown-unknown` target may not be installed
  = help: consider downloading the target with `rustup target add wasm32-unknown-unknown`

error[E0463]: can't find crate for `core`
  --> /Users/patrickstivalchaerke/.cargo/registry/src/github.com-1ecc6299db9ec823/itoa-1.0.2/src/lib.rs:45:5
   |
45 | use core::{ptr, slice, str};
   |     ^^^^ can't find crate
   |
   = note: the `wasm32-unknown-unknown` target may not be installed
   = help: consider downloading the target with `rustup target add wasm32-unknown-unknown`

error: cannot find macro `debug_assert_eq` in this scope
  --> /Users/patrickstivalchaerke/.cargo/registry/src/github.com-1ecc6299db9ec823/itoa-1.0.2/src/udiv128.rs:39:5
   |
39 |     debug_assert_eq!(quot, n / d as u128);
   |     ^^^^^^^^^^^^^^^

error: cannot find macro `debug_assert_eq` in this scope
  --> /Users/patrickstivalchaerke/.cargo/registry/src/github.com-1ecc6299db9ec823/itoa-1.0.2/src/udiv128.rs:40:5
   |
40 |     debug_assert_eq!(rem as u128, n % d as u128);
   |     ^^^^^^^^^^^^^^^

error[E0463]: can't find crate for `core`
 --> /Users/patrickstivalchaerke/.cargo/registry/src/github.com-1ecc6299db9ec823/ryu-1.0.10/src/buffer/mod.rs:2:5
  |
2 | use core::mem::MaybeUninit;
  |     ^^^^ can't find crate
  |
  = note: the `wasm32-unknown-unknown` target may not be installed
  = help: consider downloading the target with `rustup target add wasm32-unknown-unknown`

error[E0463]: can't find crate for `core`
 --> /Users/patrickstivalchaerke/.cargo/registry/src/github.com-1ecc6299db9ec823/ryu-1.0.10/src/buffer/mod.rs:3:5
  |
3 | use core::{slice, str};
  |     ^^^^ can't find crate
  |
  = note: the `wasm32-unknown-unknown` target may not be installed
  = help: consider downloading the target with `rustup target add wasm32-unknown-unknown`

error[E0463]: can't find crate for `core`
  --> /Users/patrickstivalchaerke/.cargo/registry/src/github.com-1ecc6299db9ec823/ryu-1.0.10/src/d2s.rs:27:5
   |
27 | use core::mem::MaybeUninit;
   |     ^^^^ can't find crate
   |
   = note: the `wasm32-unknown-unknown` target may not be installed
   = help: consider downloading the target with `rustup target add wasm32-unknown-unknown`

error[E0433]: failed to resolve: use of undeclared type `MaybeUninit`
  --> /Users/patrickstivalchaerke/.cargo/registry/src/github.com-1ecc6299db9ec823/itoa-1.0.2/src/lib.rs:80:22
   |
80 |         let bytes = [MaybeUninit::<u8>::uninit(); I128_MAX_LEN];
   |                      ^^^^^^^^^^^ use of undeclared type `MaybeUninit`

[Edit 2]

I saw that the beginning of the output says I should consider installing target wasm32-unknown-unknown.

But I actually do have it installed. Another terminal output:

yew-app git:(master) ✗ rustup target add wasm32-unknown-unknown
info: component 'rust-std' for target 'wasm32-unknown-unknown' is up to date

yew-app git:(master) ✗ rustc -V
rustc 1.59.0

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

卸妝后依然美 2025-02-11 15:02:51

实际上,我从自制的和Rusup分别安装了生锈。我想他们在一起表现不佳。

我从啤酒中卸载了Rust,重新安装的Rustup安装了WASM-BIND-CLI,添加了目标并起作用。

我运行的命令列表:

rustup target remove wasm32-unknown-unknown
rustup self uninstall
brew uninstall rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup target add wasm32-unknown-unknown
cargo install --locked trunk
cargo clean
trunk clean
cargo install --locked wasm-bindgen-cli

# And finally
trunk serve

Actually I had rust from homebrew and rustup installed separately. I guess they do not play well together.

I uninstalled rust from brew, reinstalled rustup, installed wasm-bindgen-cli, added the target and it worked.

List of commands I have run:

rustup target remove wasm32-unknown-unknown
rustup self uninstall
brew uninstall rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup target add wasm32-unknown-unknown
cargo install --locked trunk
cargo clean
trunk clean
cargo install --locked wasm-bindgen-cli

# And finally
trunk serve
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文