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

Created on 26 May 2020  路  6Comments  路  Source: SergioBenitez/Rocket

Compiling bootstrap v0.1.0 (/home/marga/Desktop/Dev/Rust/bootstrap)
error[E0463]: can't find crate for rocket
--> src/main.rs:3:14
|
3 | #[macro_use] extern crate rocket;
| ^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to previous error

For more information about this error, try rustc --explain E0463.
error: could not compile bootstrap.

To learn more, run the command again with --verbose.

invalid

Most helpful comment

@isaacdarcilla Can you show your Cargo.toml please?

All 6 comments

@isaacdarcilla Can you show your Cargo.toml please?

```toml
[package]
name聽=聽"bootstrap"
version聽=聽"0.1.0"
authors聽=聽["isaacdarcilla聽isaacdarcilla@gmail.com"]
edition聽=聽"2018"

聽See聽more聽keys聽and聽their聽definitions聽at聽https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies.rocket_contrib]
rocket聽=聽"0.4.4"
default-features聽=聽false
features聽=聽["handlebars_templates",聽"tera_templates"]```

Here's the Cargo.toml

@isaacdarcilla Can you show your Cargo.toml please?

https://github.com/isaacdarcilla/sbadmin2-rust

Your dependency section should look something like this:

[dependencies]
rocket = "0.4.4"
rocket_contrib = { version = "0.4.4", default-features = false, features = [ "handlebars_templates",  "tera_templates" ] }

alternatively

[dependencies]
rocket = "0.4.4"

[dependencies.rocket_contrib]
version = "0.4.4"
default-features = false
features = ["handlebars_templates", "tera_templates"]

rocket and rocket_contrib are two diffrent crates, rocket contains the core and rocket_contrib contains nice to haves like templateing and JSON responders.

[dependencies.rocket_contrib]
rocket = "0.4.4"
default-features = false
features = ["handlebars_templates", "tera_templates"]

I think this is "just" a typo: rocket = "0.4.4" should be version = "0.4.4". Please re-open if that doesn't work either!

馃敡 Configured for development.
=> address: localhost
=> port: 8000
=> log: normal
=> workers: 8
=> secret key: generated
=> limits: forms = 32KiB
=> keep-alive: 5s
=> tls: disabled
馃洶 Mounting /:
=> GET / (index)
馃殌 Rocket has launched from http://localhost:8000

Thanks, it worked!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

haheute picture haheute  路  4Comments

incker picture incker  路  3Comments

GoRustafari picture GoRustafari  路  3Comments

kitsuneninetails picture kitsuneninetails  路  4Comments

sphinxc0re picture sphinxc0re  路  3Comments