inkdevhub / swanky-cli

The all-in-one developer environment for Parity pallet-contracts based smart contracts!
https://docs.astar.network/docs/build/wasm/swanky-suite/cli/
MIT License
70 stars 29 forks source link

[BUG]: UnknownError: Command failed with ENOENT #222

Open ltfschoen opened 2 months ago

ltfschoen commented 2 months ago

What happened?

When create a new flipper template using https://github.com/ltfschoen/XCMTemplate by following these steps in the README after following the steps to run it in Docker https://github.com/ltfschoen/XCMTemplate?tab=readme-ov-file#build--upload-ink-rust-flipper-smart-contract-to-local-testnet-using-swanky-cli-, when I run yarn && yarn run run-node or swanky node start it outputs

error:   UnknownError: Command failed with ENOENT: --finalize-delay-sec 0 --rpc-cors http://localhost:*,http://127.0.0.1:*,https://localhost:*,https://127.0.0.1:*,https://polkadot.js.org,https://contracts-ui.substrate.io/
spawn --finalize-delay-sec ENOENT

Or if i run swanky node start --tmp --verbose it outputs

error:   UnknownError: Command failed with ENOENT: --finalize-delay-sec 0 --dev
spawn --finalize-delay-sec ENOENT

Steps to reproduce

  1. create a new flipper template using https://github.com/ltfschoen/XCMTemplate by following these steps in the README after following the steps to run it in Docker https://github.com/ltfschoen/XCMTemplate?tab=readme-ov-file#build--upload-ink-rust-flipper-smart-contract-to-local-testnet-using-swanky-cli-
  2. run yarn && yarn run run-node or swanky node start
  3. view error
    error:   UnknownError: Command failed with ENOENT: --finalize-delay-sec 0 --rpc-cors http://localhost:*,http://127.0.0.1:*,https://localhost:*,https://127.0.0.1:*,https://polkadot.js.org,https://contracts-ui.substrate.io/
    spawn --finalize-delay-sec ENOENT

Expected behavior

it should start the swanky node instead of generating that error

Actual behavior

it generates error:

error:   UnknownError: Command failed with ENOENT: --finalize-delay-sec 0 --rpc-cors http://localhost:*,http://127.0.0.1:*,https://localhost:*,https://127.0.0.1:*,https://polkadot.js.org,https://contracts-ui.substrate.io/
spawn --finalize-delay-sec ENOENT

Environment

stable-x86_64-unknown-linux-gnu (default) rustc 1.77.2 (25ef9e3d8 2024-04-09)

- Node version (run `node --version`)

v20.12.2


Note: I get the same error even if i switch to Node.js v18.20.2

### Logs, Errors, Screenshots

<img width="1228" alt="Screenshot 2024-04-18 at 11 39 48 am" src="https://github.com/inkdevhub/swanky-cli/assets/6226175/e5bc9504-76f7-48c0-9673-e00e2e8ebc8c">

### Additional information

_No response_
ltfschoen commented 2 months ago

upon initial inspection of the https://docs.astar.network/docs/build/wasm/swanky-suite/cli/, it says that "swanky-cli, as well as environment in the swanky-base image, and supported tools target ink! v4, and use cargo contract v2".

it also says here https://docs.astar.network/docs/build/wasm/swanky-suite/node#compatible-ink-version that only ink! 4.0.0 is supported.

it also says here https://docs.astar.network/docs/build/environment/ink_environment/#rust-and-cargo that due to a bug in cargo-contract, building contracts with rust nightly 1.70.0 or higher will fail. It is advised to use rustc v1.69.0 or older until the issue is resolved from cargo-contract side

currently i'm running

so to be able to use swanky-cli (instead of cargo contracts node and the latest versions shown above), it's necessary to downgrade to:

ltfschoen commented 2 months ago

so i reverted to the older versions by running the following

# 1.69.0 is nightly-2023-02-09
export RUST_NIGHTLY=2023-02-09
export CARGO_CONTRACT_VERSION=2.1.0

rustup toolchain install nightly-${RUST_NIGHTLY} --target wasm32-unknown-unknown --profile minimal --component rustfmt clippy rust-src
ln -s "/usr/local/rustup/toolchains/nightly-${RUST_NIGHTLY}-x86_64-unknown-linux-gnu" \
                /usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu
rustup default nightly-${RUST_NIGHTLY}-x86_64-unknown-linux-gnu
cargo install cargo-dylint dylint-link
cargo install cargo-contract --version ${CARGO_CONTRACT_VERSION} --locked

note: it was necessary to use --locked otherwise it gave errors

i then modified the wasm-flipper Cargo.toml file to use ink! 4.0.0 as shown below

[dependencies]

ink = { version = "4.0.0", default-features = false }
...

[dev-dependencies]
ink_e2e = "4.0.0"

then ran

cd dapps/ink-rust
nvm install
nvm use
yarn global add @astar-network/swanky-cli@3.1.0

cd ./wasm-flipper/contract/flipper
swanky node start

but i still got the error

error:   UnknownError: Command failed with ENOENT: --finalize-delay-sec 0 --rpc-cors http://localhost:*,http://127.0.0.1:*,https://localhost:*,https://127.0.0.1:*,https://polkadot.js.org,https://contracts-ui.substrate.io/
spawn --finalize-delay-sec ENOENT
ltfschoen commented 2 months ago

if i run

swanky node install
swanky node start

it shows better errors including:

bin/swanky-node: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by bin/swanky-node)
bin/swanky-node: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.29' not found (required by bin/swanky-node)
bin/swanky-node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by bin/swanky-node)
bin/swanky-node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by bin/swanky-node)
bin/swanky-node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by bin/swanky-node)
error:   UnknownError: Command failed with exit code 1: bin/swanky-node --finalize-delay-sec 0 --rpc-cors http://localhost:*,http://127.0.0.1:*,https://localhost:*,https://127.0.0.1:*,https://polkadot.js.org,https://contracts-ui.substrate.io/
Please report this bug at: https://github.com/swankyhub/swanky-cli/issues
    at makeError (file:///usr/local/share/.config/yarn/global/node_modules/execa/lib/error.js:60:11)
    at handlePromise (file:///usr/local/share/.config/yarn/global/node_modules/execa/index.js:124:26)
    at async StartNode.run (file:///usr/local/share/.config/yarn/global/node_modules/@astar-network/swanky-cli/dist/commands/node/start.js:9:9)
    at async StartNode._run (/usr/local/share/.config/yarn/global/node_modules/@astar-network/swanky-cli/node_modules/@oclif/core/lib/command.js:117:22)
    at async Config.runCommand (/usr/local/share/.config/yarn/global/node_modules/@astar-network/swanky-cli/node_modules/@oclif/core/lib/config/config.js:329:25)
    at async run (/usr/local/share/.config/yarn/global/node_modules/@astar-network/swanky-cli/node_modules/@oclif/core/lib/main.js:89:16)
    at async Module.execute (/usr/local/share/.config/yarn/global/node_modules/@astar-network/swanky-cli/node_modules/@oclif/core/lib/main.js:154:5)
    at async file:///usr/local/share/.config/yarn/global/node_modules/@astar-network/swanky-cli/bin/run.js:4:1