无法编译Move:执行aptos move compile报错“Profile superuser未找到”原因咨询
问题原因及解决方法
报错原因
你使用的superuser是Aptos CLI配置文件中的profile名称,但--named-addresses参数的语法规则是:如果要引用profile对应的地址,必须用profile:<profile名>的格式;直接写profile名称会被CLI当作普通的地址字符串解析,导致找不到对应的profile配置,从而抛出错误。
正确用法示例
方式1:直接指定具体地址值
aptos move compile --package-dir aptos-move/move-examples/hello_blockchain/ --named-addresses hello_blockchain=0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
方式2:引用已配置的profile地址(正确格式)
aptos move compile --package-dir aptos-move/move-examples/hello_blockchain/ --named-addresses hello_blockchain=profile:superuser
补充说明
--named-addresses的作用是将Move包中声明的命名地址映射为实际的链上地址,支持两种输入:
- 十六进制格式的完整地址(如
0x1) - 用
profile:<profile名>引用CLI配置中已存在的profile对应的账户地址
内容的提问来源于stack exchange,提问作者movingprog
相关产品推荐
相关产品推荐

