How to install Truffle & TestRPC on Windows for Blockchain development

Update: Since this tutorial was published, we have released Ganache a personal blockchain and a replacement to the TestRPC. We have left this tutorial unaltered, but we highly recommend checking out our Working with Ganache page.

This post was originally published by David Burela on his blog Burela's House-o-blog. Big thanks to David for allowing us publish it here!

I have been doing a bunch of Blockchain development work, one of which was recently featured on the front page of the Australian Financial Review and on Microsoft’s news website.

One of the trickiest things has been trying to get Windows environments correctly configured, as the tools are npm based and want to be compiled natively and assumes it is on a Linux machine. Here is the simplest install script I have found

 Step 0. Pre-step: Install Chocolatey

Install Chocolatey via

 Step 1. Install Windows tools with Chocolatey:

Open a PowerShell prompt as an Administrator and run the following commands (last command optional):

$ choco install nodejs.install –y
$ choco install git –y
$ choco install VisualStudioCode -y

Read more about configuring Visual Studio code for Blockchain development. image

 Step 2. Install the tools via npm:

Open a NEW PowerShell prompt as Administrator (to ensure that it reloads), then run the following commands:

$ npm install -g npm
$ npm install -g -production windows-build-tools
$ npm install -g ethereumjs-testrpc
$ npm install -g truffle

You may see some error messages during npm installs. Many of these are just informational / optional components failing. You can test that it is all working by trying to run the commands truffle and testrpc.
image image

 Bonus Step: combining with Visual Studio Code

This is how I use Truffle & Visual Studio code together. Make sure you install and configure Visual Studio Code with the Solidity extensions.

If you navigate into the folder where your files are, typing “code .” will open Visual Studio Code in the current folder. Running the command after a truffle init gets you up and running quickly image image