when build contract with RUSTFLAGS='-C link-arg=-s' cargo wasm, it shows bellow error.

After installed wasm-pack with cargo install, it still shows this error. How can I fix it?
when build contract with RUSTFLAGS='-C link-arg=-s' cargo wasm, it shows bellow error.

After installed wasm-pack with cargo install, it still shows this error. How can I fix it?
On
Don't install cargo-wasm package for this. Usually we don't use cargo-wasm package for cargo wasm. cargo wasm is an alias for wasm = "build --release --lib --target wasm32-unknown-unknown" usually. So do the following.
Create a folder named .cargo and a .cargo/config file. Then add the following content.
[alias]
wasm = "build --release --lib --target wasm32-unknown-unknown"
wasm-debug = "build --lib --target wasm32-unknown-unknown"
Then the command cargo wasm or RUSTFLAGS='-C link-arg=-s' cargo wasm should work as expected.
Try to install cargo-wasm:
then
to see if was correctly installed
then setup your project
Cheers!