Have Visual Studio use System-wide Node/NPM

January 16, 2016

When Visual Studio 2015 installs, it will install with it's own copy and version of Node/NPM. When commands are run within the context of Visual Studio, say within the Task Runner, they are invoked from that version of NPM and node. If you pop-up a command prompt or PowerShell window and invoke commands within that folder, you'll be invoking from the system-wide installed Node/NPM.  You can change Visual Studio to point to the same version of node/NPM so that everyone is in sync. Here's the steps,

  1. Open up a Administrator Privileged text editor, notepad's fine.
  2. Navigate to the following Visual Studio folder, C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Web Tools\External\
  3. Edit the contents of the node.cmd file to point to your installation of node
@"C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" %*

If you have Node installed as a 32 bit install, then you'll want to point to the x86 folders.

@"C:\Program Files (x86)\nodejs\node.exe" "C:\Program Files (x86)\nodejs\node_modules\npm\bin\npm-cli.js" %*

That's it. Restart Visual Studio and you should be good to go!