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
Install Chocolatey via https://chocolatey.org/
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
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.
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