Tell Visual studio to use correct version

I found this little “gotcha” when using visual studio together with a node based project. In my case the latest version of angular, which has dependencies to run a specific node version, say 6.x. I have this installed and I can build the project from the terminal without problems. However when building from visual studio it fails with the following error.

The error:

^
SyntaxError: Unexpected token = 
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
...

The problem:

The problem is that visual studio get shipped with it’s own copy of “web tools” that it will use as default and these tools quickly become outdated.

The solution:

To fix this, in Visual Studio select Menu -> Tools -> Projects and Solutions -> Web Package Management -> External Web Tools then make sure your order is:

  • local packages first;
  • global tools (PATH);
  • then VS bundled tools.
visual studio tools settings


Hope this will be of help to people experiencing similar issues

Pin It on Pinterest

Share This

Share This

Share this post with your friends!