当 运行 collection-examples-as 时,yarn deploy 给出错误命令失败,退出代码为 1

yarn deploy give error with Command failed with exit code 1 when running collection-examples-as

我正在尝试 运行 集合示例 - 作为近示例但是当我 运行 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
}

有什么帮助或建议吗?

旧版本的 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