dscvr-one / ic-drip

IC DRIP
http://icdrip.io
47 stars 19 forks source link

`npm run dfx:setup` and the cargo executing went wrong. #1

Open cyaolong opened 3 years ago

cyaolong commented 3 years ago

When I run npm run dfx:setup the following prompt come out. I don't know what it means.

➜  ic-drip-main npm run dfx:setup
> ic_loot@1.0.0 dfx:setup
> dfx canister create --all && dfx build && npm run dfx:install

Creating canister "ic_loot_assets"...
"ic_loot_assets" canister was already created and has canister id: "rrkah-fqaaa-aaaaa-aaaaq-cai"
Creating canister "ic_loot_rs"...
"ic_loot_rs" canister was already created and has canister id: "ryjl3-tyaaa-aaaaa-aaaba-cai"
Building canisters...
Executing 'cargo build --target wasm32-unknown-unknown --release --package ic_loot_rs'
thread 'main' panicked at 'Could not run custom tool.: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/dfx/src/lib/builders/custom.rs:181:31
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
rckprtr commented 3 years ago

Do you have the right cargo target installed?

https://www.hellorust.com/news/native-wasm-target.html

What version of dfx?

cyaolong commented 3 years ago

Do you have the right cargo target installed?

https://www.hellorust.com/news/native-wasm-target.html

What version of dfx?

Thanks for your help. My dfx version is 0.8.1. I have installed Rust, rustup rustup toolchain install nightly and cargo target using rustup target add wasm32-unknown-unknown --toolchain nightly according to the website you provided. And then when I run the code again, the same error came out.

cyaolong commented 3 years ago

Do you have the right cargo target installed?

https://www.hellorust.com/news/native-wasm-target.html

What version of dfx?

After restart MacBook, new problem came out as below.

➜  ic-drip-main npm run dfx:setup

> ic_loot@1.0.0 dfx:setup
> dfx canister create --all && dfx build && npm run dfx:install

Creating canister "ic_loot_assets"...
"ic_loot_assets" canister was already created and has canister id: "rrkah-fqaaa-aaaaa-aaaaq-cai"
Creating canister "ic_loot_rs"...
"ic_loot_rs" canister was already created and has canister id: "ryjl3-tyaaa-aaaaa-aaaba-cai"
Building canisters...
Executing 'cargo build --target wasm32-unknown-unknown --release --package ic_loot_rs'
    Finished release [optimized] target(s) in 0.30s
Building frontend...
The post-build step failed for canister 'rrkah-fqaaa-aaaaa-aaaaq-cai' with an embedded error: The command '"npm" "run" "build"' failed with exit status 'exit code: 127'.
Stdout:

> ic_loot@1.0.0 build
> vite build

Stderr:
sh: vite: command not found
rckprtr commented 3 years ago

did you run?

npm install
cyaolong commented 3 years ago

did you run?

npm install

Thanks. I have solved it but another problem as below:

➜  ic-drip-main npm run dfx:setup

> ic_loot@1.0.0 dfx:setup
> dfx canister create --all && dfx build && npm run dfx:install

Creating canister "ic_loot_assets"...
"ic_loot_assets" canister was already created and has canister id: "rrkah-fqaaa-aaaaa-aaaaq-cai"
Creating canister "ic_loot_rs"...
"ic_loot_rs" canister was already created and has canister id: "ryjl3-tyaaa-aaaaa-aaaba-cai"
Building canisters...
Executing 'cargo build --target wasm32-unknown-unknown --release --package ic_loot_rs'
    Finished release [optimized] target(s) in 0.37s
Building frontend...

> ic_loot@1.0.0 dfx:install
> dfx canister --network=ic ic_loot_rs --all --mode reinstall

error: Found argument 'ic_loot_rs' which wasn't expected, or isn't valid in this context

If you tried to supply `ic_loot_rs` as a PATTERN use `-- ic_loot_rs`

USAGE:
    dfx canister [FLAGS] [OPTIONS] <SUBCOMMAND>

For more information try --help
rckprtr commented 3 years ago
dfx canister --network=ic install ic_loot_rs --all --mode reinstall

my bad!

cyaolong commented 3 years ago
dfx canister --network=ic install ic_loot_rs --all --mode reinstall

my bad!

Thanks @rckprtr. I modified the code and there is another error:

➜  ic-drip-main npm run dfx:setup

> ic_loot@1.0.0 dfx:setup
> dfx canister create --all && dfx build && npm run dfx:install

Creating canister "ic_loot_assets"...
"ic_loot_assets" canister was already created and has canister id: "rwlgt-iiaaa-aaaaa-aaaaa-cai"
Creating canister "ic_loot_rs"...
"ic_loot_rs" canister was already created and has canister id: "rrkah-fqaaa-aaaaa-aaaaq-cai"
Building canisters...
Executing 'cargo build --target wasm32-unknown-unknown --release --package ic_loot_rs'
    Finished release [optimized] target(s) in 0.43s
Building frontend...

> ic_loot@1.0.0 dfx:install
> dfx canister --network=ic install ic_loot_rs --all --mode reinstall

Cannot find canister id. Please issue 'dfx canister --network ic create ic_loot_rs'.
rckprtr commented 3 years ago

You may want to restart the IC using this command

dfx start --clean

You may have an instance already running that is configured for another project.

cyaolong commented 3 years ago

You may want to restart the IC using this command

dfx start --clean

You may have an instance already running that is configured for another project.

I try and the message as below:

➜  ic-drip-main npm run dfx:setup

> ic_loot@1.0.0 dfx:setup
> dfx canister create --all && dfx build && npm run dfx:install

Creating a wallet canister on the local network.
The wallet canister on the "local" network for user "default" is "rwlgt-iiaaa-aaaaa-aaaaa-cai"
Creating canister "ic_loot_assets"...
"ic_loot_assets" canister created with canister id: "rrkah-fqaaa-aaaaa-aaaaq-cai"
Creating canister "ic_loot_rs"...
"ic_loot_rs" canister created with canister id: "ryjl3-tyaaa-aaaaa-aaaba-cai"
Building canisters...
Executing 'cargo build --target wasm32-unknown-unknown --release --package ic_loot_rs'
    Finished release [optimized] target(s) in 0.35s
Building frontend...

> ic_loot@1.0.0 dfx:install
> dfx canister --network=ic install ic_loot_rs --all --mode reinstall

Cannot find canister id. Please issue 'dfx canister --network ic create ic_loot_rs'.
➜  ic-drip-main dfx canister --network ic create ic_loot_rs
Creating canister "ic_loot_rs"...
The Replica returned an error: code 3, message: "Canister 63k2f-nyaaa-aaaah-aakla-cai has no update method 'wallet_create_canister'"
rckprtr commented 3 years ago

Change

dfx canister --network=ic install ic_loot_rs --all --mode reinstall

To

dfx canister install ic_loot_rs --all

Also just use dfx deploy moving forward.

cyaolong commented 3 years ago

Change

dfx canister --network=ic install ic_loot_rs --all --mode reinstall

To

dfx canister install ic_loot_rs --all

Also just use dfx deploy moving forward.

Thanks a lot! There is no error now. But which url should be opened?

➜  ic-drip-main npm run dfx:setup

> ic_loot@1.0.0 dfx:setup
> dfx canister create --all && dfx build && npm run dfx:install

Creating canister "ic_loot_assets"...
"ic_loot_assets" canister was already created and has canister id: "rrkah-fqaaa-aaaaa-aaaaq-cai"
Creating canister "ic_loot_rs"...
"ic_loot_rs" canister was already created and has canister id: "ryjl3-tyaaa-aaaaa-aaaba-cai"
Building canisters...
Executing 'cargo build --target wasm32-unknown-unknown --release --package ic_loot_rs'
    Finished release [optimized] target(s) in 0.43s
Building frontend...

> ic_loot@1.0.0 dfx:install
> dfx canister install ic_loot_rs --all

Creating UI canister on the local network.
The UI canister on the "local" network is "r7inp-6aaaa-aaaaa-aaabq-cai"
Installing code for canister ic_loot_rs, with canister_id ryjl3-tyaaa-aaaaa-aaaba-cai
rckprtr commented 3 years ago
dfx canister call ic_loot_rs claim

then open up

http://rrkah-fqaaa-aaaaa-aaaaq-cai.localhost:8000/?tokenId=1