Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
cyaolong opened this issue Sep 9, 2021 · 12 comments
Open

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

cyaolong opened this issue Sep 9, 2021 · 12 comments

Comments

@cyaolong
Copy link

cyaolong commented Sep 9, 2021

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
> [email protected] 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
Copy link
Contributor

rckprtr commented Sep 9, 2021

Do you have the right cargo target installed?

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

What version of dfx?

@cyaolong
Copy link
Author

cyaolong commented Sep 9, 2021

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
Copy link
Author

cyaolong commented Sep 9, 2021

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

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

> [email protected] build
> vite build


Stderr:
sh: vite: command not found

@rckprtr
Copy link
Contributor

rckprtr commented Sep 9, 2021

did you run?

npm install

@cyaolong
Copy link
Author

cyaolong commented Sep 9, 2021

did you run?

npm install

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

➜  ic-drip-main npm run dfx:setup

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

> [email protected] 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
Copy link
Contributor

rckprtr commented Sep 9, 2021

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

my bad!

@cyaolong
Copy link
Author

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

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

> [email protected] 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
Copy link
Contributor

rckprtr commented Sep 10, 2021

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
Copy link
Author

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

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

> [email protected] 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
Copy link
Contributor

rckprtr commented Sep 12, 2021

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
Copy link
Author

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

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

> [email protected] 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
Copy link
Contributor

rckprtr commented Sep 15, 2021

dfx canister call ic_loot_rs claim

then open up

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants