My_first_app: hc generate zomes/my_zome - Rust not installed

Okay @dhtnetwork, you mean the specs of my Windows machine on which I am running Virtualbox, right?

Here you are:


Hope this helps…

1 Like

@sachaweb disk resizing in the config is provided by a vagrant plugin

e.g.

vagrant plugin install vagrant-disksize

some things in vagrant require a full destroy/rebuild, some only require a reprovision

typically config for the box itself (e.g. swap) would require a rebuild while running things on the OS can be a reprovision - for our box we use nix to handle provisioning, but this general rule is the same if we were using e.g. chef, ansible, puppet, etc.

vagrant is slow relative to e.g. docker but it is free virtualisation that is supported everywhere VirtualBox is supported, if you can use something like WSL2 or docker you might get better performance

windows file system performance is a known issue in general, for example it takes 10+ minutes to install the rust documentation, ignoring all virtualisation considerations - https://github.com/rust-lang/rustup.rs/issues/998

WSL2 vs WSL1 is apparently a 2-20x speedup for file system performance - https://devblogs.microsoft.com/commandline/announcing-wsl-2/

one thing that we can try to do upstream would be to rebuild the vagrant box so that it comes with more things provisioned - this is a quality of life thing that should be done from time to time as things drift relative to the last time we built a box. this would only help if you’re seeing a lot of nix/rust things happening to cause the slowness

you’re welcome to use nix-env, the reasons we aren’t recommending it moving forward:

  • nix-env is a “once off” tool, as in, you need to keep re-upping it as we upgrade holonix, whereas nix-shell automatically scans your system and keeps you up to date as a moving target
  • nix-env installs holochain and hc just fine, but then some of the hc commands need a working cargo install, which means that to use those specific commands you need to be in nix-shell anyway
  • nix-env might be getting removed from future versions of nix, i have no info or eta on this deprecation, i’m going off something @Yana said here

@sachaweb when you see “disk space full” from inside the box, can you run df -h and send the output?

i’d like to see what exactly is full and how big the full thing is :slight_smile:

1 Like

Sorry for being slow to respond, other matters required my attention, I will most likely try out your suggestions tomorrow and send output to you here.

@sachaweb np :slight_smile: whenever you’re ready

Okay @thedavidmeister and @dhtnetwork, I am not getting the disk space error any longer! (It’s confusing when you’re expecting misery and things actually work!) I changed absolutely nothing. (Except I upgraded my Win10 machine from 8GB RAM to 16GB - could that have done the trick??)

@thedavidmeister: here’s the output you requested (including the last lines of the seemingly successful install (nix-shell https://holochain.love):

manifest-rust-std-x86_64-unknown-linux-gnu: /nix/store/fmlyxb53asc095aqzzq692wwvnkqvka7-rust/lib/rustlib/manifest-rust-std-x86_64-unknown-linux-gnu
uninstall.sh: /nix/store/fmlyxb53asc095aqzzq692wwvnkqvka7-rust/lib/rustlib/uninstall.sh

[nix-shell:/vagrant]$ df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 198M 0 198M 0% /dev
tmpfs 2.0G 0 2.0G 0% /dev/shm
tmpfs 989M 3.4M 985M 1% /run
tmpfs 2.0G 300K 2.0G 1% /run/wrappers
/dev/sda1 39G 25G 12G 68% /
tmpfs 2.0G 0 2.0G 0% /sys/fs/cgroup
vagrant 930G 270G 661G 29% /vagrant
tmpfs 396M 88K 396M 1% /run/user/1000

[nix-shell:/vagrant]$

1 Like

Super happy to hear about this good news! Thank you for letting us know. The upgrade could be a factor.

Okay now I moved ahead, as the “hc generate zomes/my_zome” worked out… to some extent. There’s an error in the end, hereby the last lines of the output:

Compiling my_zome v0.1.0 (/vagrant/my_first_app/zomes/my_zome/code)
Finished release [optimized] target(s) in 8m 22s

cargo build --release --target=wasm32-unknown-unknown --target-dir=/home/vagrant/nix-holochain/my_zome/target
Finished release [optimized] target(s) in 0.24s
Created DNA package file at “/vagrant/my_first_app/dist/my_first_app.dna.json”
DNA hash: QmRbZyKAj9An5D8vXew6M7kPymCik2oRYfwRHYXyWe2YTj
Installing node_modules
npm install --silent
Error: command npm install --silent was not successful

[nix-shell:/vagrant/my_first_app]$

(I kept the entire output just in case.)

Another question remains: should I keep my Vagrantfile modified? (As in “if it ain’t broke don’t fix it.”) I only changed the swap file size to 4096 (from 16384). That was last week, it didn’t help, but now it works with the same modified Vagrantfile, after adding RAM to my PC (if that’s the reason it works now).

The line is:

swapDevices: [ { device: “/swapfile”, size: 4096 } ],

(Modifying Vagrantfile back to normal again would imply “Vagrant destroy”, meaning I should start all over again, which is pretty slow on a Windows PC.)

And this is what happens if I make a second attempt to generate zomes:

[vagrant@nixos:/vagrant/my_first_app]$ nix-shell https://holochain.love

[nix-shell:/vagrant/my_first_app]$ hc generate zomes/my_zome

cargo init --lib --vcs none
error: cargo init cannot be run on existing Cargo packages
Error: command cargo init --lib --vcs none was not successful

[nix-shell:/vagrant/my_first_app]$

(Of course, the cargo command had run already and the zomes code was generated so it makes sense. I just wonder about the error in my previous post, “command npm install --silent was not successful”.)

…and this is what happens when I run ‘hc test’:


Compiling holochain_wasm_utils v0.0.25-alpha1 (https://github.com/holochain/holochain-rust?tag=0.0.25-alpha1#1327abe5)
Compiling hdk v0.0.25-alpha1 (https://github.com/holochain/holochain-rust?tag=0.0.25-alpha1#1327abe5)
Compiling my_zome v0.1.0 (/vagrant/zomes/my_zome/code)
Finished release [optimized] target(s) in 1m 12s
Created DNA package file at “/vagrant/dist/vagrant.dna.json”
DNA hash: QmTwV3k9J88Bq1SWojBsksAS82ufv9owsiSx9tUhrmuZB3
Error: Directory test does not exist

[nix-shell:/vagrant]$

Not sure if that’s so bad… After all, I did get my zomes generated and now with ‘hc test’ I had my zome being compiled, with a ‘code’ folder being generated…

@sachaweb i’m suspicious about the npm install command as documented here https://docs.holochain.love/docs/node/

nothing should require that, it should always use local npm binaries in node_modules/.bin

sounds like a bug in hc to me :confused:

as far as the memory limits, go with what works for you, there’s nothing magic about the default config

1 Like

The error about directory test when doing ‘hc test’: that was just dumb of me, I was not in the my_first_app directory. I still get errors now but not sure if that matters:


Error: Cannot find module ‘@holochain/diorama’

Error: command node test/index.js was not successful

I have to figure out now how to write my first app and then we’ll see.

If I don’t come back to this thread, thanks a lot @thedavidmeister and @dhtnetwork for your help.

2 Likes

@maackle @wollum any idea why diorama wouldn’t be found after a fresh hc scaffold? ^^