Tools, Visual Studio, Web

Synchronizing node version with your environment in Visual Studio 2017

1 min read

Visual Studio 2017 is official finally out and Microsoft did a tremendous job in listening to their user base. They simplified the install process, enhanced the speed of the load of the projects, enhanced their IntelliSense and debugging tools to say the least. If you have not tried it yet, go and grab yourself a copy today! The community edition is free and is available to everyone!

On that note, one may remember the nodejs binding problem that would occur in Visual Studio 2015 when it comes to gulp and node-sass

This happens because Visual Studio has a set of paths that are searched to find node/npm etc. By default Visual Studio 2017 comes with Node 5.4.1 and npm 3.3.4 shipped. As you may know from one of my previous posts, you can manage and update the version of node and npm of your system. You thus may want to use those version in Visual Studio. To do so, you need to do the following:

  1. I assume that nodejs and npm are in your environment paths. To find out if they are, run the following in a powershell window  $env:path.split(";")
    1. If they are not in your environment, you may want to find the location of node, by default node install to C:\Program Files\nodejs
  2. Now in Visual Studio, go to Tools -> Options -> Projects and Solutions -> Web Package Management -> External Web Tools
  3. In the location of the external tools, you see that $(PATH) is 3rd in the search list. Move it up the chain to the first. If you want to use a specific location of node, you may want to add a location and set it as the first of the chain.
  4. Restart your Visual Studio for it to take effect

Visual Studio 2017 External Web Tools