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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't run wrker-build, assumes ~/.cargo/bin is in PATH and fails otherwise #45

Closed
tv42 opened this issue Sep 10, 2021 · 4 comments
Closed

Comments

@tv42
Copy link

tv42 commented Sep 10, 2021

馃悰 Bug report

Describe the bug

This is just developer friction / newbie trap.

Wrangler 1.19.2 installed by building via cargo.

Reproduce the bug

With the template Rust workers demo from https://blog.cloudflare.com/workers-rust-sdk/

$ wrangler dev 
馃寑  Running cargo install -q worker-build && worker-build --release
sh: worker-build: command not found
Error: Build failed! Status Code: 127

$ PATH="$PATH:$HOME/.cargo/bin"
$ wrangler dev 
馃寑  Running cargo install -q worker-build && worker-build --release
Installing wasm-pack...

Expected behavior

Ideally:

  1. Don't rely on user $PATH.
  2. Don't even attempt to install things on the fly automatically. (My opinion.)

Environment and versions

Fill out the following information about your environment.

  • operating system: Linux, NixOS 21.05
  • output of wrangler -V: wrangler 1.19.2
  • output of node -v: node: command not found
  • content of wrangler.toml: unedited from template
@nilslice
Copy link
Contributor

Hey @tv42 - thanks for reporting this.

If you're already using Rust, you're probably using cargo, which itself is a very opinionated toolchain that generally makes these same assumptions. I agree it's preferable to not install tools so automatically and to be as flexible as possible. But, the goal here is largely to make it as easy as possible to get a project built.

You're welcome to run your own build script in place of the one placed in the template though! Happy to consider any suggestions to work around your 2 ideals above.

@nilslice
Copy link
Contributor

Is the issue with PATH being used just that you didn't have your PATH set after installing Rust via something like rustup? If so, rustup does explain that you'd need to add that directory to your path, or even add it for you I believe.

@nilslice nilslice transferred this issue from cloudflare/wrangler-legacy Sep 13, 2021
@nilslice
Copy link
Contributor

@tv42 - I transferred this issue to the workers-rs repo for posterity. I am going to close this for now, but please feel free to re-open, or continue the conversation. We are all-ears to suggestions!

@tv42
Copy link
Author

tv42 commented Sep 16, 2021

I didn't use rustup to install rust, and consider having randomly named things from random projects at random versions in my $PATH both a usability, reproducability, and security problem. But I'm not going to bother trying to change your mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants