Our Cookie Policy

Echofavor and carefully selected third parties use cookies on this site to improve performance, for analytics and to show you offers tailored to your interests on our site and third party sites. By continuing to use our site, you consent to our use of cookies. Privacy Policy

Life is memorable. Share your experience. Help others. Return the favor. Terms Of Use    Privacy Policy    About    FAQ    Help   Contact Us  
As an Amazon Associate and affiliate with other third parties, Echofavor earn from qualifying purchases and display advertisements.
0.3332351

The build task could not find node.exe which is required to run the TypeScript compiler

  • mcchu28
  • 4784 views


Table of Contents:


I encounter the following compile error after I update Visual Studio 2015 from update 2 to 3.

1>C:\Program Files (x86)\Microsoft SDKs\TypeScript\3.2\build\Microsoft.TypeScript.targets(376,5): error : The build task could not find node.exe which is required to run the TypeScript compiler. Please install Node and ensure that the system path contains its location.

1. You can install latest node.js using Nuget Package Manager Console with the following command:

PM> Install-Package Node.js.redist -Version 13.1.0

This didn't work. This only install to the project. You want to install globally.

2. Next, I try installing the nodejs from download at:

https://nodejs.org/en/download/

This works.

Troubleshooting

If solution 2 did not work, you need to make sure when you install you select Add Path. This will add the path to node.exe to Path environment variable so that MSBuild process will be able to find the node.exe.

We know now it should be installed somewhere on this machine. I search for node.exe and found it located at:

C:\Program Files (x86)\nodejs\node.exe

This node version is 12.14.1


When you get the error in Visual Studio, double click on it to go to the file in question. It should bring you to

C:\Program Files (x86)\Microsoft SDKs\TypeScript\3.2\build\Microsoft.TypeScript.targets

In the file, you will notice a task call VsTsc. And the NodePath is equal to $(NodePath). Next, search for NodePath in the file. You will find the <PropertyGroup> section and a few items that says <NodePath>.

 

<!-- Best effort probing for node.exe in the VS install folder. If not found, then we assume node is already installed and on the system path. -->

    <NodePath Condition="'$(OS)' == 'Windows_NT' AND Exists('$(MSBuildExtensionsPath)\Microsoft\VisualStudio\NodeJs\node.exe')">$(MSBuildExtensionsPath)\Microsoft\VisualStudio\NodeJs</NodePath>

    <!--Legacy node.exe path for VS2017 -->

    <NodePath Condition="'$(NodePath)' == '' AND '$(OS)' == 'Windows_NT' AND Exists('$(VsInstallRoot)\Common7\IDE\CommonExtensions\Microsoft\NodeJs\node.exe')">$(VsInstallRoot)\Common7\IDE\CommonExtensions\Microsoft\NodeJs</NodePath>

    <!--Another legacy node.exe path for VS2017 -->

    <NodePath Condition="'$(NodePath)' == '' AND '$(OS)' == 'Windows_NT' AND Exists('$(VsInstallRoot)\Web\External\x86\node.exe')">$(VsInstallRoot)\Web\External\x86</NodePath>

What is MSBuildExtensionsPath?

It is usually C:\Program Files (x86)\MSBuild


I don't see the NodeJs folder in C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio.

This means node should be installed on the system path that is stored on environment variables.

In windows search bar, search for environment variables. Open it, find the system variable Path.

The Path environment variable should have been setup from previous installation. I can see listed on this variable:

C:\Program Files (x86)\nodejs\

You need to restart the machine for the environment variable to work.













  

Copyright © Echofavor 2021. All Rights Reserved. Powered by Echofavor
Copyright © Echofavor 2021. All Rights Reserved.
Powered by Echofavor
/* */