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.
https://davidburela.wordpress.com/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:
https://davidburela.wordpress.com/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:

Open a PowerShell prompt as Administrator


choco install nodejs.install -y
choco install git -y
choco install VisualStudioCode -y #optional

Read more about configuring Visual Studio code for Blockchain development in my other post.

image

 

Step 2. Install the tools via npm:


Open a NEW PowerShell prompt as Administrator (to ensure that it reloads the path)


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

image

You may see some informational notes that optional components were skipped. You can 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

17 thoughts on “How to install Truffle & TestRPC on Windows for Blockchain development

  1. Works like a charm,
    I am exploring blockchain, can you suggest the next logical post I should follow to move in right direction?

  2. There is a small error in the text if you copy for deploy: ”npm install -g –production windows-build-tools”.
    You get the error: Argument starts with non-ascii dash, this is probably invalid: [ ‘–production’, ‘windows-build-tools’ ].
    It should be “npm install -g -production windows-build-tools”.

  3. hi, the truffledemo not exits on my Temp files and , Everything has gone well until then, the testrpc gave me as a result test accounts and etc … I only have problem with that, where is my truffledemo?

    • jajajaja. How silly I feel, but that’s how I learn. I had to create the folder … OMG …. it already works for me and I’ll start programming, … thank you!

      • I ran through the steps and simplified it further. and updated that screenshot for you (but the point was to show that `code .` worked, not the other commands)

  4. for beginners like me: as SL says, you have to create a test folder and name it whatever you want (truffletest) via commands mkdir xyz, then enter it via cd xyz, and start with “truffle int”, after that with “code .” you will get the extension running… and it is awesome!

  5. Hi David / anyone reading. First up thanks David for these super useful tutorials / posts. Really saved me a lot of time. I noticed after your latest update that the article is missing the command to install the windows build tools – npm install -g -production windows-build-tools. I think they are still needed – or at least some of them are, I just tried going through this setup again on a new machine and got quite a few errors when trying to run npm install on the truffle boxes – most seem to relate to python being missing but their could be others.

    • Do you need someone to read the instructions for you, Zulfi? Was there a particular word that was too complicated?

Leave a reply to Samuel Leiton Cancel reply