(Solved) error: toolchain ‘nightly-x86_64-pc-windows-msvc’

Have you ever cloned a Rust project on your local machine, installed all its dependencies, and attempted to compile it but you came across the error error: toolchain 'nightly-x86_64-pc-windows-msvc' is not installed. No worries, here is how you can fix this error.

To fix the error error: toolchain 'nightly-x86_64-pc-windows-msvc' is not installed , make sure to run rustup toolchain install nightly to install nightly-x86_64-pc-windows-msvc.

rustup toolchain install nightly

Explanation: What are release channels?

Rust has three different release channels:

  • Nightly
  • Beta
  • Stable

Think about release channels as the different versions that Rust has available. Typically, most Rust developers use the stable release. However, those who want to experiment with the latest Rust features can install the nightly or beta Rust channels.

As the name suggest, the nightly channel is the Rust version produced every night. Which means, every time someone from the Rust team merges new code changes to the master branch on any given day, the nightly version will contain those set of changes, regardless if there could be bugs when introducing new features that are not fully tested.

Hence, if you are using nightly versions of Rust to use experimental features, don’t be surprised if your Rust code stops working the next day as there is high chance the code base could change for those experimental features.

In the case of the error error: toolchain 'nightly-x86_64-pc-windows-msvc' is not installed , it is telling you that a specific toolchain is not installed. To validate this, you can check the toolchain list installed in your machine using the following command:

rustup toolchain list

For example, prior to running across the error error: toolchain 'nightly-x86_64-pc-windows-msvc' is not installed, I had the following list of toolchains installed in my windows machine:

List of toolchains installed when getting the error error: toolchain 'nightly-x86_64-pc-windows-msvc' is not installed

After I ran rustup toolchain install nightly to install the nightly channel, the toolchain list is now:

Updated toolchain list after installing nightly version

Updating the default toolchain

Notice, that there is a “(default)” tag on a specific toolchain. In my case, I want to a stable toolchain as the default option. However, in the case I need to use the nightly version on a regular basis, I could switch to the default toolchain using the following command:

rustup default nightly

or

rustup default nightly-x86_64-pc-windows-msvc