Help us understand the problem. What is going on with this article?

【Rust】WebフレームワークRocketを動かしたときのエラー

More than 1 year has passed since last update.

概要

RustのWebフレームワークを使ったときにエラーが出たのでメモ。Rockerのドキュメントのクイックスタートをやってみました。問題の解決方法としてはcargo rustを実行するときにrustのnightly版を使って実行すれば解決できますが、nightlyの使い方を知るまでに時間がかかりました。エラー内容は長いので記事の最後に記載します。

(2018/05/10追記)
@ykonomi さんがコメントに載せてくださったやり方でnightlyを動かすのでも良さそうです!

環境:windows10

やったこと

nightlyをinstall

rustc install nightly

nightlyをつかう。この'+nightly'を知るまでに時間がかかった。

cargo +nightly run

これで実行できた。

エラー内容

error: failed to run custom build command for `rocket_codegen v0.3.8 (file:///xxx/rust/Rocket/codegen)`
process didn't exit successfully: `xxx\rust\Rocket\target\debug\build\rocket_codegen-d2d1541e746ad235\build-script-build` (exit code: 101)
--- stderr
?[1;31mError:?[0m ?[37mRocket requires a nightly or dev version of Rust.?[0m
?[37mInstalled version is:?[0m ?[33m1.25.0 (2018-03-25)?[0m. ?[37mMinimum required:?[0m ?[33m1.27.0-nightly (2018-04-06)?[0m.
?[34mSee the getting started guide (?[0m?[37mhttps://rocket.rs/guide/getting-started/?[0m?[34m) for more information.?[0m
thread 'main' panicked at 'Aborting compilation due to incompatible compiler.', codegen\build.rs:38:17
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: failed to run custom build command for `pear_codegen v0.0.16`
process didn't exit successfully: `xxx\rust\Rocket\target\debug\build\pear_codegen-a28c5dcc6703d3d8\build-script-build` (exit code: 101)
--- stderr
?[1;31mError:?[0m ?[37mPear requires a nightly or dev version of Rust.?[0m
?[37mInstalled version is:?[0m ?[33m1.25.0 (2018-03-25)?[0m. ?[37mMinimum required:?[0m ?[33m1.27.0-nightly (2018-04-14)?[0m.
thread 'main' panicked at 'Aborting compilation due to incompatible compiler.', xxx\.cargo\registry\src\github.com-1ecc6299db9ec823\pear_codegen-0.0.16\build.rs:31:13
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: failed to run custom build command for `rocket v0.3.8 (file:///xxx/rust/Rocket/lib)`
process didn't exit successfully: `xxx\rust\Rocket\target\debug\build\rocket-c96e4e05a2a699a0\build-script-build` (exit code: 101)
--- stderr
?[1;31mError:?[0m ?[37mRocket requires a nightly or dev version of Rust.?[0m
?[37mInstalled version is:?[0m ?[33m1.25.0 (2018-03-25)?[0m. ?[37mMinimum required:?[0m ?[33m1.27.0-nightly (2018-04-03)?[0m.
?[34mSee the getting started guide (?[0m?[37mhttps://rocket.rs/guide/getting-started/?[0m?[34m) for more information.?[0m
thread 'main' panicked at 'Aborting compilation due to incompatible compiler.', lib\build.rs:38:13
note: Run with `RUST_BACKTRACE=1` for a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed

20180501追記

nightlyをデフォルトにすることができるみたい。やってはいないが、これで+nightlyの指定がいらなくなるのかな。

rustup default nightly

参考

https://github.com/rust-lang-nursery/rustup.rs/issues/762
https://rocket.rs/guide/quickstart/#running-examples
https://qiita.com/yyu/items/18df35988f3ea3b12af0

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away