Failed to build Move modules: "Unable to resolve packages for package 'my_first_package'"

1.2k Views Asked by At

New to move and sui.

I am trying to follow the documentation on Sui and attempted to use the command sui move build to build my move package.

I encountered this error:

Failed to build Move modules: "Unable to resolve packages for package 'my_first_package'".

Attached picture below shows:

  1. my folder structure in local.
  2. the content of the .toml file.
  3. sui cloned locally pointing to devnet branch.

attached picture

3

There are 3 best solutions below

0
On

I had the same issue, and I realized that the tutorial I was following was using deprecated location.

It went from:

Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework", rev = "devnet" }

to

Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "framework/testnet" }

A more permanent solution would be to use sui move new tmp_package and then look at the auto generated Move.toml file.

0
On

I solved my own problem, lol, by pointing Sui dependency correctly to sui-framework/ on local.

Content of .toml file:

[package]
name = "my_first_package"
version = "0.0.1"

[dependencies]
Sui = { local = "../sui/crates/sui-framework/"}
# { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework", rev = "devnet" }

[addresses]
my_first_package =  "0x0"
sui =  "0x2"

Originally, retrieving from git was taking too long to build so it might be better to git clone sui to local and build relying on local.

1
On

Afaik you don't need to define 'sui' as a named address in the .toml file at all.

[package]
name = "MyModule"
version = "0.0.1"

[dependencies]
Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework", rev = "devnet" }

[addresses]
my_module =  "0x0"

works just fine