swanky-cli icon indicating copy to clipboard operation
swanky-cli copied to clipboard

[BUG]: UnknownError: Command failed with ENOENT

Open ltfschoen opened this issue 1 year ago • 3 comments

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

  • Operating System macOS 14.1.1
  • Project version/tag: (run 'swanky version') 3.1
  • Rust version (run rustup show)
active toolchain
----------------

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

Screenshot 2024-04-18 at 11 39 48 am

Additional information

No response

ltfschoen avatar Apr 18 '24 01:04 ltfschoen

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

  • ink v4.2.1 (even though they're up to ink v5)
  • cargo-contract v4.1.0
  • rustc 1.77.2 (25ef9e3d8 2024-04-09) nightly-2023-03-21

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:

  • ink! to 4.0.0
  • cargo-contract v2.1.0
  • rustc to 1.69 (2023-03-21) https://github.com/rust-lang/rust/blob/master/RELEASES.md,

ltfschoen avatar Apr 18 '24 01:04 ltfschoen

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/[email protected]

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 avatar Apr 18 '24 03:04 ltfschoen

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

ltfschoen avatar Apr 18 '24 04:04 ltfschoen