Error while trying "Hello Holo tutorial"!

Today, I tried to go through the tutorials to learn more about Holochain and Rust programming. Unfortunately, I got the following error message:

[nix-shell:~/holochain/core_concepts/cc_tuts]$ hc package

cargo build --release --target=wasm32-unknown-unknown --target-dir=…/target
Updating crates.io index
error: no matching package named hdk-proc-macros found
location searched: registry https://github.com/rust-lang/crates.io-index
required by package hello v0.1.0 (/home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code)
Error: Couldn’t traverse DNA in directory “/home/vagrant/holochain/core_concepts/cc_tuts”: command cargo build --release --target=wasm32-unknown-unknown --target-dir=…/target was not successful

Can somebody give me some hint or a solution for that? That would be great.
Best regards, Sven

Thanks for the flag, we’ll look into the issue. @freesig

1 Like

Hey @newprometheus
Just having a look into this now

1 Like

Could you show me what is in the cc_tuts/zomes/hello/code/Cargo.toml for the hdk-proc-macros line?
It should be something like:

hdk-proc-macros = { git = "https://github.com/holochain/holochain-rust", tag = "v0.0.34-alpha1" }

I have a feeling there is a broken version and we might just need to bump it to a new version.

I got the same error code. This is my vagrant-shell terminal output:

[nix-shell:~/holochain/core_concepts/cc_tuts]$ hc package
> cargo build --release --target=wasm32-unknown-unknown --target-dir=../target
Updating crates.io index
error: no matching package named `hdk-proc-macros` found
location searched: registry `https://github.com/rust-lang/crates.io-index`
required by package `hello v0.1.0 (/home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code)`
Error: Couldn't traverse DNA in directory "/home/vagrant/holochain/core_concepts/cc_tuts": command cargo build --release --target=wasm32-unknown-unknown --target-dir=../target was not successful

[nix-shell:~/holochain/core_concepts/cc_tuts]$

and this my Cargo file;

[nix-shell:~/holochain/core_concepts/cc_tuts/zomes/hello/code]$ cat Cargo.toml
[package]
name = "hello"
version = "0.1.0"
authors = ["vagrant"]
edition = "2018"

[dependencies]
serde = "=1.0.89"
serde_json = { version = "=1.0.39", features = ["preserve_order"] }
serde_derive = "=1.0.89"
hdk = "=0.0.34-alpha1"
hdk-proc-macros = "=0.0.34-alpha1"
holochain_wasm_utils = "=0.0.34-alpha1"
holochain_json_derive = "=0.0.17"

[lib]
path = "src/lib.rs"
crate-type = ["cdylib"]

Thanks. @dhtnetwork and @freesig

I got same error message too.

@f13end @ahmetKM thank you for flagging. Yes, there seems to be a pattern with you all reporting the issue. :writing_hand::hammer_and_wrench:

My Cargo.toml file looks exactly the same!

hdk-proc-macros = “=0.0.34-alpha1”

My Cargo-toml file looks quite different:

hdk-proc-macros = “=0.0.34-alpha1”

I’m trying to reproduce this now with the same versions.
Those Cargo.toml files look wrong to me. It should be a git. “=0.0.34-alpha1” doesn’t make any sense.
@thedavidmeister Is this a weird vagrant / windows thing or is something broken?

Yep I’m also getting this. There’s a bug in hc generate that isn’t creating the Cargo.toml correctly.
I’ll report back when this is fixed.

Ok looks like
This:

hdk-proc-macros = "=0.0.34-alpha1"

Should be this:

hdk_proc_macros = "=0.0.34-alpha1"

Will update the generator but if you change this manually it should work :slight_smile:

1 Like

Yes to get it to compile I had to correct the following section of “./cc_tuts/zomes/hello/code/Cargo.toml” to be:

[dependencies]
serde = "=1.0.89"
serde_json = { version = "=1.0.39", features = ["preserve_order"] }
serde_derive = "=1.0.89"
hdk = { git = "https://github.com/holochain/holochain-rust", tag = "v0.0.34-alpha1" }
hdk-proc-macros = { git = "https://github.com/holochain/holochain-rust", tag = "v0.0.34-alpha1" }
holochain_wasm_utils = { git = "https://github.com/holochain/holochain-rust", tag = "v0.0.34-alpha1" }
holochain_json_derive = { version = "0.0.17" }

You might need to update the version tags of “v0.0.34-alpha1” with the current release.

1 Like

You can git rid of the git’s now that we are on crates.io.
You can copy this if you’d like:

[dependencies]
serde = "=1.0.89"
serde_json = { version = "=1.0.39", features = ["preserve_order"] }
serde_derive = "=1.0.89"
hdk = "=0.0.34-alpha1"
hdk_proc_macros = "=0.0.34-alpha1"
holochain_wasm_utils = "=0.0.34-alpha1"
holochain_json_derive = "=0.0.17"

[lib]
path = "src/lib.rs"
crate-type = ["cdylib"]
1 Like

Thank you very much @freesig! It worked!!!
I opened the Cargo.toml file in the editor with vim Cargo.toml. Than typed “i” for insert and changed the line “hdk-proc-macros=…” in “hdk_proc_macros=…” and typed “:wq!” to save it. After that I tried “hc package” again…

And than it worked properly! Thanks for your effort!
So I will move on to study the tutorials to learn more about Holochain.

1 Like

Sorry, now I´m running into the next problem. I could modify the lib.rs file and compiled it, so that I got the right result:
Created DNA package file at “/home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json”
DNA hash: QmXuPFimMCoYQrXqX9vr1vve8JtpQ7smfkw1LugqEhyWTr

But when I then run: “hc run -i http” I got the following error message:

[nix-shell:~/holochain/core_concepts/cc_tuts/zomes/hello/code/src]$ hc run -i http
Reading DNA from /home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json
conductor: boot_from_config
Reading DNA from /home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json
Reading DNA from /home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json
conductor: build_conductor_api instance_id=test-instance, config=Configuration { agents: [AgentConfiguration { id: “hc-run-agent”, name: “testAgent”, public_address: “HcScjN8wBwrn3tuyg89aab3a69xsIgdzmX5P9537BqQZ5A7TEZu7qCY4Xzzjhma”, keystore_file: “testAgent”, holo_remote_key: None, test_agent: Some(true) }], dnas: [DnaConfiguration { id: “hc-run-dna”, file: “/home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json”, hash: “QmXuPFimMCoYQrXqX9vr1vve8JtpQ7smfkw1LugqEhyWTr”, uuid: None }], instances: [InstanceConfiguration { id: “test-instance”, dna: “hc-run-dna”, agent: “hc-run-agent”, storage: Memory }], interfaces: [InterfaceConfiguration { id: “websocket-interface”, driver: Http { port: 8888 }, admin: true, instances: [InstanceReferenceConfiguration { id: “test-instance”, alias: None }] }], bridges: [], ui_bundles: [], ui_interfaces: [], logger: LoggerConfiguration { logger_level: “debug”, rules: LogRules { rules: [] }, state_dump: true }, network: None, persistence_dir: “”, signing_service_uri: None, encryption_service_uri: None, decryption_service_uri: None, dpki: None, signals: SignalConfig { trace: false, consistency: false }, passphrase_service: Cmd }
Reading DNA from /home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json
Reading DNA from /home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json
Failed to load instance test-instance from storage: ErrorGeneric(“State could not be loaded due to NoneError”)
Initializing new chain…
Error: Error while trying to create instance “test-instance”: Holochain Instance Error: Attempting to initialize DNA with zero zomes!

What I did wrong???

Same error for me;

[nix-shell:~/holochain/core_concepts/cc_tuts/zomes/hello/code/src]$ hc package
Created DNA package file at "/home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json"
DNA hash: QmXuPFimMCoYQrXqX9vr1vve8JtpQ7smfkw1LugqEhyWTr

[nix-shell:~/holochain/core_concepts/cc_tuts/zomes/hello/code/src]$ hc run -i http
Reading DNA from /home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json
conductor: boot_from_config
Reading DNA from /home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json
Reading DNA from /home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json
conductor: build_conductor_api instance_id=test-instance, config=Configuration { agents: [AgentConfiguration { id: "hc-run-agent", name: "testAgent", public_address: "HcScjN8wBwrn3tuyg89aab3a69xsIgdzmX5P9537BqQZ5A7TEZu7qCY4Xzzjhma", keystore_file: "testAgent", holo_remote_key: None, test_agent: Some(true) }], dnas: [DnaConfiguration { id: "hc-run-dna", file: "/home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json", hash: "QmXuPFimMCoYQrXqX9vr1vve8JtpQ7smfkw1LugqEhyWTr", uuid: None }], instances: [InstanceConfiguration { id: "test-instance", dna: "hc-run-dna", agent: "hc-run-agent", storage: Memory }], interfaces: [InterfaceConfiguration { id: "websocket-interface", driver: Http { port: 8888 }, admin: true, instances: [InstanceReferenceConfiguration { id: "test-instance", alias: None }] }], bridges: [], ui_bundles: [], ui_interfaces: [], logger: LoggerConfiguration { logger_level: "debug", rules: LogRules { rules: [] }, state_dump: true }, network: None, persistence_dir: "", signing_service_uri: None, encryption_service_uri: None, decryption_service_uri: None, dpki: None, signals: SignalConfig { trace: false, consistency: false }, passphrase_service: Cmd }
Reading DNA from /home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json
Reading DNA from /home/vagrant/holochain/core_concepts/cc_tuts/zomes/hello/code/src/dist/src.dna.json
Failed to load instance test-instance from storage: ErrorGeneric("State could not be loaded due to NoneError")
Initializing new chain...
Error: Error while trying to create instance "test-instance": Holochain Instance Error: Attempting to initialize DNA with zero zomes!

oh you want to always run the hc or holochain commands from the root of the project.
So the cc_tuts folder.
I should make this more clear.

1 Like

Thanks for solution but i’m running into new problem.

[nix-shell:~]$ curl -X POST -H "Content-Type: application/json" -d '{"id": "0", "jsonrpc": "2.0", "method": "call", "params": {"instance_id": "test-instance", "zome": "hello", "function": "hello_holo", "args": {} }}' http://127.0.0.1:8888
{"jsonrpc":"2.0","error":{"code":-32602,"message":"Holochain Instance Error: Zome function 'hello_holo' not found in Zome 'hello'"},"id":"0"}

and my lib.rs file

#![feature(proc_macro_hygiene)]

extern crate hdk;
extern crate hdk_proc_macros;
extern crate serde;
extern crate serde_derive;
extern crate serde_json;
extern crate holochain_json_derive;

use hdk::{
   error::ZomeApiResult,
};


use hdk_proc_macros::zome;

#[zome]
mod hello_zome {

    #[init]
    fn init() {
        Ok(())
    }

    #[validate_agent]
    pub fn validate_agent(validation_data: EntryValidationData<AgentId>) {
        Ok(())
    }

    #[zome_fn("hc_public")]
    fn hello_holo() -> ZomeApiResult<String> {
       Ok("Hello Holo".into())
    }


}

What did i miss ?

Thanks for all advice btw…
Holo team is the best

1 Like

Hello @freesig,
well, not intentionally. I just followed the tutorial description. But of course I want to go the most reasonable way…
What would be the best method in your opinion?
Thank you very much for your support!