【问题标题】:yarn deploy give error with Command failed with exit code 1 when running collection-examples-as运行 collection-examples-as 时,yarn deploy 给出错误,Command failed with exit code 1
【发布时间】:2022-01-02 19:05:15
【问题描述】:

我正在尝试运行 collection-examples-as near 示例,但是当我运行 yarn deploy 时,出现以下错误

$ near dev-deploy --wasmFile="./contract.wasm"
Starting deployment. Account id: dev-1637744501224-6323200, node: 
https://rpc.testnet.near.org, helper: https://helper.testnet.near.org, file: 
./contract.wasm
An error occurred
Error: ENOENT: no such file or directory, open './contract.wasm'
[Error: ENOENT: no such file or directory, open './contract.wasm'] {
 errno: -2,
 code: 'ENOENT',
 syscall: 'open',
 path: './contract.wasm'
}
error Command failed with exit code 1.

我认为错误是它找不到 ./contract.wasm 的路径,所以我运行 yarn build 我尝试使用 yarn deploy 再次部署它,但我遇到了另一个错误:

$ near dev-deploy --wasmFile="./contract.wasm"
Starting deployment. Account id: dev-1637744501224-6323200, node: 
https://rpc.testnet.near.org, helper: https://helper.testnet.near.org, file: 
./contract.wasm
An error occurred
Error: Can not sign transactions for account dev-1637744501224-6323200 on network 
default, no matching key pair found in 
InMemorySigner(MergeKeyStore(UnencryptedFileSystemKeyStore(/home/rasha/.near- 
credentials), UnencryptedFileSystemKeyStore(/home/rasha/collection-examples- 
as/neardev))).
{
 type: 'KeyNotFound',
 context: undefined
}

有什么帮助或建议吗?

【问题讨论】:

    标签: nearprotocol


    【解决方案1】:

    旧版本的 near-cli 和 dev-deploy 存在问题。 作为一种解决方法,您可以尝试直接从终端运行最新的 cli:

    near dev-deploy --wasmFile="./contract.wasm" -f
    

    只需检查您是否安装了最新版本的 near-cli,目前为 2.2.0。你可以通过near --version查看你的版本。

    请务必先运行yarn build,这样您将拥有已编译的contract.wasm 文件。

    注意:当您运行yarn deploy 时,它使用package.json 中定义的旧的near-cli 版本。 (可能是一些旧版本,如 1.6.0)

    您可能还想查看这个 GitHub 问题(开发部署错误):https://github.com/near/create-near-app/issues/1408

    【讨论】:

    • 你应该用npm i -g near-cli更新你的NEAR CLI
    • 谢谢你提到问题是因为near-cli 版本。即使在我全局安装它之后,它仍然在代码中继续使用旧版本,这就是为什么我将 package.json 中的版本更新为 2.2.0 然后我再次运行 yarn install 并且它工作了
    猜你喜欢
    • 2019-02-10
    • 1970-01-01
    • 2011-08-20
    • 2019-03-27
    • 2015-11-09
    • 1970-01-01
    • 1970-01-01
    • 2013-01-01
    • 2020-11-04
    相关资源
    最近更新 更多