Skip to content
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

Unhelpful error thrown when cargo is missing #13

Open
shirakaba opened this issue Jan 23, 2023 · 2 comments
Open

Unhelpful error thrown when cargo is missing #13

shirakaba opened this issue Jan 23, 2023 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@shirakaba
Copy link

shirakaba commented Jan 23, 2023

TypeError: Cannot read properties of null (reading 'toString')

This rather cryptic error is thrown from:

console.error(cargo.stderr.toString().trim());

... when trying to call cargo.stderr.toString(). The reason is that cargo.stderr may be null if a cargo executable was not found by the call to spawnSync('cargo' /* ... other args... */).

Troubleshooting:

If, when you run which cargo in your usual shell, you get cargo not found or similar, then you need to make sure the cargo executable is both installed and on your shell's path.

Recommendations:

I think ideally this library should have some way of double-checking whether cargo is indeed on-path (I'm not sure what the usual approach for this is), but this kind of environment health-check may arguably be out-of-scope.

At the very least, it would save some onboarding friction if this library could, in the event of cargo.stderr being null, suggest that perhaps cargo is either not installed or not on path.

@rnag
Copy link
Owner

rnag commented Feb 4, 2023

Hi @shirakaba ! Thanks for opening this issue. I agree this would be a worthwhile addition and for quality of life purposes, at least for making developer's life easier.

I suppose that an argument could be made, that as a user would ideally already have cargo and a working rust environment set up -- it is briefly mentioned in the "getting started" section.

Although, I agree that for clarity sake it might be better for onboarding purposes as was mentioned -- as not everyone would necessarily have cargo installed beforehand.

That said, I would more than welcome a contribution towards achieving or addressing this issue. If not, I can certainly look into this as and when time allows.

@rnag rnag added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Feb 4, 2023
@shirakaba
Copy link
Author

For now I'm just happy that if anyone else runs into the same issue, they'll find this pointer in the GitHub Issues! Not starving for it to be implemented anytime soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants