How i can add dependancies?


#1

I am new in rust Lang

My pc internet is proxy protected so i am getting error when adding rand = “0.3.0” dependency

#cargo build
Updating registry https://github.com/rust-lang/crates.io-index
warning: spurious network error (2 tries remaining): [12/-2] [56] Failure when receiving data from the peer
warning: spurious network error (1 tries remaining): [12/-2] [56] Failure when receiving data from the peer
error: Unable to update registry https://github.com/rust-lang/crates.io-index

is there any way to download dependency and add it manually


#2

There is proxy key in Cargo config, perhaps it can help?

You need to create ~/.cargo/config text file and add

[http]
proxy = "your proxy server" 

More docs are here: http://doc.crates.io/config.html


#3

Thanks for reply

i have added my proxy in ~/.cargo/config file

but still not working.


#4

This seems to be more of a networking problem than one with rust/cargo. You’ll need to find out why cargo can’t talk to the Github servers.