How to change node version in Visual Studio 2017

By default Visual Studio 2017 comes with Node 5.4.1 and npm 3.3.4 shipped, and is using them even if you install a new version of Node.js. This happens because Visual Studio has a set of paths that are searched to find node/npm.

If you have a newer versions it might cause problems when restoring packages for example and you may want to tell Visual Studio to use another version.

To check what version of node and npm you have, open Command Prompt (or Windows Powershell) and type

  • npm --version (or shortly npm -v)
  • node --version (or shortly node -v)

You should see something like this:

PS C:\Users\scb> npm --version
5.5.1
PS C:\Users\scb> node --version
v8.9.1

Modifications:

  1. Visual Studio : go to Tools -> Options -> Projects and Solutions -> Web Package Management -> External Web Tools

    Visual Studio 2017 - External Web Tools
    Visual Studio 2017 – External Web Tools
  2. Modify .\node_modules\.bin to C:\Program Files\nodejs (by default node is installed to this location)

    Visual Studio 2017 - Location of external tools
    Visual Studio 2017 – Location of external tools
  3. Restart your Visual Studio for it to take effect

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *