rustup update报错,如何移除wasm32-wasi并添加wasm32-wasip1?
解决rustup update中wasm32-wasi不可用的问题
执行rustup update时遇到以下错误:
error: component 'rust-std' for target 'wasm32-wasi' is unavailable for download for channel 'nightly' error: Sometimes not all components are available in any given nightly. If you don't need the component, you could try a minimal installation with: error: error: rustup toolchain add nightly --profile minimal error: error: If you require these components, please install and use the latest successful build version, error: which you can find at <https://rust-lang.github.io/rustup-components-history>. error: error: After determining the correct date, install it with a command such as: error: error: rustup toolchain install nightly-2018-12-27 error: error: Then you can use the toolchain with commands such as: error: error: cargo +nightly-2018-12-27 build
根据官方信息,自2024-10-17起nightly渠道不再提供wasm32-wasi目标,需切换为wasm32-wasip1。以下是移除旧目标并添加新目标的步骤:
步骤1:移除旧的wasm32-wasi目标
针对nightly工具链执行移除命令:
rustup target remove wasm32-wasi --toolchain nightly
若该目标属于全局默认工具链,可省略--toolchain nightly参数:
rustup target remove wasm32-wasi
步骤2:添加新的wasm32-wasip1目标
针对nightly工具链添加新目标:
rustup target add wasm32-wasip1 --toolchain nightly
全局默认工具链则使用:
rustup target add wasm32-wasip1
验证操作
执行以下命令确认目标已切换:
rustup target list --toolchain nightly | grep wasm
输出应显示wasm32-wasip1 (installed),且wasm32-wasi不再标记为已安装状态。
内容的提问来源于stack exchange,提问作者Evan Carroll
相关产品推荐
相关产品推荐

