Search code examples
nearprotocol

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


I am trying to run the collection-examples-as near example but when I run yarn deploy it gives me the following error

$ 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.

I think the error is it can't find the path to ./contract.wasm so I run yarn build the I tried to deploy it again using yarn deploy but I got another error which is:

$ 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
}

any help or suggestions?


Solution

  • There's an issue with old versions of near-cli and dev-deploy. As a workaround, you can try running the latest cli directly from your terminal:

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

    Just check that you installed the latest version of near-cli, currently 2.2.0. You can check your version with near --version.

    Be sure to run yarn build first, so you'll have the compiled contract.wasm file.

    Note: When you run yarn deploy, it uses the old near-cli version defined in package.json. (probably some old version like 1.6.0)

    You might also want to check this GitHub issue (dev-deploy error): https://github.com/near/create-near-app/issues/1408