Archived: This tutorial has been archived and may not work as expected; versions are out of date, methods and workflows may have changed. We leave these up for historical context and for any universally useful information contained.
David Burela now recommends a different, updated way of doing this on his blog, which you can check out here: How to install Truffle & TestRPC on Ubuntu or Windows 10 with ?"Windows subsystem for Linux"
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 Ganache Documentation
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!
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 https://chocolatey.org/
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
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.
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