'AssemblyScript on NEAR: `/bin/sh: asb: command not found` when deploying Guest Book with yarn
When running the GuestBook example on NEAR using yarn deploy the following error is produced:
/bin/sh: asb: command not found
This appears to be happening to people using the Figment Learn NEAR path as well, based on Discord conversations.
Running
npm install asb
returns
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: [email protected]
npm WARN node_modules/assemblyscript
npm WARN assemblyscript@"^0.17.3" from [email protected]
npm WARN node_modules/near-sdk-core
npm WARN near-sdk-core@"^2.2.4" from [email protected]
npm WARN node_modules/near-sdk-as
npm WARN 1 more (@as-pect/cli)
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer assemblyscript@"^0.13.3" from [email protected]
npm WARN node_modules/visitor-as
npm WARN visitor-as@"^0.3.2" from [email protected]
npm WARN node_modules/near-sdk-core
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/asb - Not found
npm ERR! 404
npm ERR! 404 'asb@*' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
Edit:
Many yarn install and yarn update commands later, the error seems to have migrated to a missing asc library:
$ asb
node:internal/modules/cjs/loader:926
throw err;
^
Error: Cannot find module 'assemblyscript/cli/asc'
Solution 1:[1]
You are correct the asb command is short for asbuild (which is another alias command), which is a dependency of near-sdk-as and should be installed with yarn or yarn install.
asc, installed as assemblyscript, should also be present because it is a dependency of near-sdk-as. So it not being found is suspicious. My guesses are:
- You need to run
yarnfirst to install everything. - Somehow
NODE_ENVwas set to be"production", which then causesyarnto install onlydependenciesand notdevDependencies. To fix this unset it withNODE_ENV=orexport NODE_ENV=. Then runyarnagain.
My one complaint with npm and yarn is that you need to have an install step. Rust's cargo installs dependencies as needed.
Solution 2:[2]
I had a similar issue and I fixed it by login first to running yarn.
step 1: run near login and connect your wallet (testnet or mainnet for instance)
step 2: run yarn to install all dependencies.
This should works... greetings!
Solution 3:[3]
In my case too, I was constantly getting this error no matter what I did;
asb: command not found
While I was just giving up hope, this command was my solution.
yarn add -D near-sdk-as
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | |
| Solution 2 | Patricio Zavala Fuenzalida |
| Solution 3 | malibil |
