How to install Truffle & TestRPC on Windows for Blockchain development
UPDATE 2017/08/25:
Now that Truffle has made installation easier, I have cleaned up and streamlined the windows install steps below.
I highly recommend installing Truffle via WSL instead.
/2017/05/12/how-to-install-truffle-testrpc-on-ubuntu-or-windows-10-with-windows-subsystem-for-Linux/
---
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 expect to be running on a Linux machine. Here is the simplest install steps I have found
Step 0. Don't follow this guide, instead install via WSL
I do not recommend installing Node directly to Windows. Many NPM packages fail to test on Windows and as a result fail to install. Using "Windows Subsystem for Linux" on Windows 10 works much better. Follow my other guide:
/2017/05/12/how-to-install-truffle-testrpc-on-ubuntu-or-windows-10-with-windows-subsystem-for-Linux/
If you don't have Windows 10, and really want to install directly on Windows then continue.
Step 1. If you really want to continue: Install windows tools with chocolatey:
- Install Chocolatey via https://chocolatey.org/
Open a PowerShell prompt as Administrator
[code language="bash" gutter="false"]
choco install nodejs.install -y
choco install git -y
choco install VisualStudioCode -y #optional
[/code]
Read more about configuring Visual Studio code for Blockchain development in my other post.
Step 2. Install the tools via npm:
Open a NEW PowerShell prompt as Administrator (to ensure that it reloads the path)
[code language="bash" gutter="false"]
npm install -g npm
npm install -g --production windows-build-tools
npm install -g ethereumjs-testrpc truffle
[/code]
You may see some informational notes that optional components were skipped. You can 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