I’m trying to create a Rust app in Glitch, and I’m having trouble installing new packages through cargo.
I’ve found at least two projects that are using Rust already:
- hello-rust is using Iron as a backend, which it’s pulling into Cargo.toml. In a thread about language support from last year, the author mentions installing other Rust packages, like actix.
- rust-web-server is using vanilla Rust, no third-party packages
The first example showed that installing packages worked at some point!
But if I remix either of these projects and start trying to installing my own dependencies (or in the cast of hello-rust, just run it in my own namespace), I get an error from Cargo:
$ cargo build
error: failed to load source for a dependency on `oauth-client`
Caused by:
Unable to update registry `https://github.com/rust-lang/crates.io-index`
Caused by:
failed to open: /opt/rust/cargo/registry/index/github.com-1ecc6299db9ec823/.cargo-index-lock
Caused by:
Permission denied (os error 13)
Inspecting it in the console, I see that the directory is owned by root:
$ ls -l /opt/rust/cargo
total 8
drwxr-xr-x 2 root root 4096 Jun 28 03:39 bin
-rw-r--r-- 1 root root 40 Jun 28 03:40 env
Am I missing something I should be doing to install packages with Rust? Have the permissions on this directory changed in the last year or something?
(This might also just be a bad idea, if Glitch has to recompile dependencies on cold start. Just curious if I’m missing something, because I couldn’t find explanations for this error elsewhere!)