-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting started guide doesn't mention npm installation, which results in Error: No such file or directory (os error 2) when running "anchor init" #3281
Comments
I'm not able to reproduce the problem unfortunately. Does it only happen if you use the
The
The post is from 2 years ago when Anchor had a different way of generating the IDLs. It's also running the This would be easy to debug if I could reproduce. |
Hey, thanks for the response! I realized why it occurred. I didn't have npm installed. https://www.anchor-lang.com/docs/installation I was following this guide on a fresh system (i believe garuda (arch) with fish, but maybe bash). I installed node directly, I believe, rather than via nvm. I think nvm may provide node and npm, possibly, and perhaps that's why the anchor-lang installation guide doesn't mention it. It might be beneficial to add a section in the installation guide for "node" and "npm" (or "nvm" if that has both node and npm), alongside the checks for Rust and Yarn. |
Possibly, but I'd prefer to handle this error in the CLI itself (provide a good error message) because the installation guide has been getting longer lately, which could be scary for new people. Since this problem is unrelated to the multiple files template, it would be great if we could either close this issue, or rename it to something that includes |
I see your point, but as a new person following the official documentation, I hit a 30 minute roadblock that hindered additional javascript testing since anchor didn't create the tests directory or package.json, or tell me exactly what went wrong. It might save a lot of time collectively if the documentation contains the two additional lines to check that the new anchor user has node and npm installed on their system, such as via:
I really think a new person would prefer to have the proper dependencies listed in the getting started guide, rather than playing guessing games with the ambiguous CLI error message. And if the documentation is comprehensive, then there's no mental discrepancy (the documentation for installation doesn't mention node or npm, but the cli error message does? why?) |
Problem:
anchor init anchor-counter --template multiple
has an OS error on Arch Linux.However, the project is created despite the error. The error occurs every time the command is run.
The solutions at https://solana.stackexchange.com/questions/1648/error-no-such-file-or-directory-os-error-2-error-from-anchor-test don't seem to solve the underlying issue - upon running the anchor init command for multiple files template, a developer shouldn't see an OS error. If it's occurring due to Anchor being unable to generate an IDL from the template, then the template should possibly include the boilerplate necessary to generate a basic IDL.
Solution:
Add the boilerplate code to the dummy files that are causing the OS error on
anchor init anchor-counter --template multiple
The text was updated successfully, but these errors were encountered: