[Newbie Question] - Invalid 'use'. Unbound module: '0x1::Debug'

Hi,

I’m new to Move and following this tutorial, but somehow I’m unable to execute this script. I’m using move-cli from the latest master branch.

    script {
        // Import the Debug module published at account address 0x1.
        // 0x1 is shorthand for the fully qualified address
        // 0x00000000000000000000000000000001.
        use 0x1::Debug;

        const ONE: u64 = 1;

        fun main(x: u64) {
            let sum = x + ONE;
            Debug::print(&sum)
        }
    }

This is the command I’m using when trying to run the script:

move-cli run demo1/src/scripts/script1.move

This is the error message I get:

error: 

   ┌── demo1/src/scripts/script1.move:5:9 ───
   │
 5 │     use 0x1::Debug;
   │         ^^^^^^^^^^ Invalid 'use'. Unbound module: '0x1::Debug'
   │

error: 

    ┌── demo1/src/scripts/script1.move:11:9 ───
    │
 11 │         Debug::print(&sum)
    │         ^^^^^ Unbound module alias 'Debug'
    │

Regards,

Hi @brakmic,
Sorry that this isn’t working for you. A couple of questions that might help us diagnose the issue:

  • Did you run the cargo install command shown in the tutorial?
  • Could you share the git hash of the version you are using? I just tried with eb4fad3f9c49a03760f89a91d82ccd96fa2a11d0 and didn’t encounter any problems.

Sam

1 Like

Hi @sblackshear,

I’ve installed the binaries by following the tutorial from here. Not sure if there is any difference if I use the scripts from there (/scripts/dev_setup.sh) instead of cargo install --git https://github.com/libra/libra move-cli.

However, I just deleted everything and reinstalled move-cli via cargo install.

And there seems to be a difference between execution of move-cli and move. Until now, the only binary available in my $HOME/.cargo/bin was move-cli (and I don’t really get the difference between move-cli and move). But after I installed the packages via cargo install the other binary, move, became available as well. And I can now run the script with move. However, trying to do the same with move-cli still returns the same error.

Many thanks for your help.

At some point, we renamed the binary from move-cli to move, so I think your move-cli binary is an artifact of an earlier installation that may not work with the current Diem branch. I think if you remove the move-cli binary (note that cargo install does not do this for you) and use the move one, everything should work as expected.

1 Like