fermyon / spin

Spin is the open source developer tool for building and running serverless applications powered by WebAssembly.
https://developer.fermyon.com/spin
Apache License 2.0
5.53k stars 257 forks source link

Spin CLI auto install missing libraries #1491

Open elbandito opened 1 year ago

elbandito commented 1 year ago

Is your feature request related to a problem? Please describe. Not that I'm aware of.

tl;dr

I made a change to the getting started Fermyon app, and after running spin build, I got the following error:

   Compiling bytes v1.2.1
   Compiling percent-encoding v2.2.0
error[E0463]: can't find crate for `std`
  |
  = note: the `wasm32-wasi` target may not be installed
  = help: consider downloading the target with `rustup target add wasm32-wasi`

For more information about this error, try `rustc --explain E0463`.
error: could not compile `fnv` due to previous error
warning: build failed, waiting for other jobs to finish...
error[E0463]: can't find crate for `core`
  |
  = note: the `wasm32-wasi` target may not be installed
  = help: consider downloading the target with `rustup target add wasm32-wasi`
   |
42 | extern crate alloc;
   | ^^^^^^^^^^^^^^^^^^^ can't find crate

error[E0463]: can't find crate for `core`

(much, much, more output to follow....)

This ^^ error was resolved after running rustup target add wasm32-wasi, but I thought how convenient it would have been if Spin took care of this for me, especially for those developers not be familiar with Rust.

Describe the solution you'd like Instead of failing with a bunch of errors, and leaving the user to comb through the output for a solution. Perhaps try and install any detected missing dependencies to begin with.

Describe alternatives you've considered None

Additional context None

JimLynchCodes commented 1 year ago

I'm seeing this error as well when I try to run spin build in a freshly scaffolded project, and I agree that end users should not see this message. This is now a bug that should be addressed by the maintainers of spin or the spin "http-rust" template... 🤔

vdice commented 1 year ago

Thanks for the feedback and apologies for the friction encountered when scaffolding a new Spin app.

We're currently brainstorming approaches to improve this experience in https://github.com/fermyon/spin/issues/1257 and https://github.com/fermyon/spin/issues/629. Any/all input is greatly appreciated.