'Terra - terrain deploy counter - Error: Command failed: cp artifacts/counter{-aarch64,}.wasm

I have been following the the Terra CosmWasm smart contract tutorial and have taken all steps outlined (tried from scratch multiple times, re-installed Rust, etc.) but always get the following error when I use the terrain deploy command.

I'd appreciate any help to understand what is causing this error, I wasn't able to find any other cases when searching online. Thanks in advance!

Command: terrain deploy counter --signer test1

Error:

using pre-baked 'test1' wallet on localterra as signer
    Finished release [optimized] target(s) in 0.07s
Running script 'optimize': 'docker run --rm -v "$(pwd)":/code --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry cosmwasm/rust-optimizer:0.12.3
'
Info: RUSTC_WRAPPER=sccache
Info: sccache stats before build
Compile requests                      0
Compile requests executed             0
Cache hits                            0
Cache misses                          0
Cache timeouts                        0
Cache read errors                     0
Forced recaches                       0
Cache write errors                    0
Compilation failures                  0
Cache errors                          0
Non-cacheable compilations            0
Non-cacheable calls                   0
Non-compilation calls                 0
Unsupported compiler calls            0
Average cache write               0.000 s
Average cache read miss           0.000 s
Average cache read hit            0.000 s
Failed distributed compilations       0
Cache location                  Local disk: "/root/.cache/sccache"
Cache size                            0 bytes
Max cache size                       10 GiB
Building contract in /code ...
    Finished release [optimized] target(s) in 0.05s
Creating intermediate hash for counter.wasm ...
28087be6244b6ac0071f90002a5851f080c61c3212c2c4be348e01fcb54f97bb  ./target/wasm32-unknown-unknown/release/counter.wasm
Optimizing counter.wasm ...
Creating hashes ...
b410547cb1a425635024aa93be1e6324f5afae602528f6e98fefd6ed5dd47749  counter.wasm
Info: sccache stats after build
Compile requests                      0
Compile requests executed             0
Cache hits                            0
Cache misses                          0
Cache timeouts                        0
Cache read errors                     0
Forced recaches                       0
Cache write errors                    0
Compilation failures                  0
Cache errors                          0
Non-cacheable compilations            0
Non-cacheable calls                   0
Non-compilation calls                 0
Unsupported compiler calls            0
Average cache write               0.000 s
Average cache read miss           0.000 s
Average cache read hit            0.000 s
Failed distributed compilations       0
Cache location                  Local disk: "/root/.cache/sccache"
Cache size                            0 bytes
Max cache size                       10 GiB
done
Finished, status of exit status: 0
cp: missing destination file operand after 'artifacts/counter{-aarch64,}.wasm'
Try 'cp --help' for more information.
    Error: Command failed: cp artifacts/counter{-aarch64,}.wasm
    cp: missing destination file operand after 'artifacts/counter{-aarch64,}.wasm'
    Try 'cp --help' for more information.


Solution 1:[1]

I figured it out, I followed the instructions for M1 Macs here: https://docs.terra.money/docs/develop/dapp/quick-start/using-terrain-localterra.html

nvm install --lts
nvm use --lts

and then used this command to install Terrain, not the one in the Terra Academy video (Apr. 2022): npm install -g @terra-money/terrain

Solution 2:[2]

I met exactly same error before. I think you downloaded terrain using following command.

npm install --global @iboss/terrain

I removed this package and used following command.

npm install --global @terra-money/terrain

I hope this will be help.

Solution 3:[3]

Not sure if this issue has been solved already, but a solution that may work:

add

--no-rebuild

after the

terrain deploy counter --signer bombay --network testnet

command(or terrain deploy counter --signer test1 I think, I used the above one)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Neel
Solution 2 Angel Brett
Solution 3 Barry Alan