none
Cannot build default Angular project in VS 2019 RRS feed

  • Question

  • I cannot build the default Angular project in Visual Studio 2019.  

    1) Installed VS 2019 with the following workloads:

                 ASP.NET and Web Development

                 Azure Development

                 Node.js development

                 .NET Desktop Development

                 Desktop Development with C++

    2) Create new project 

                Use template:   ASP.NET core Web Application

                       Choose:   .NET Core and ASP.NET Core 2.2

                                       Angular

                Create !

    3)  After project is created, attempt to build solution.

                Receive build error:    


    Warning MSB3073 The command "node --version" exited with code 9009. WebApplication4 C:\Users\RMillman\source\repos\WebApplication4\WebApplication4\WebApplication4.csproj 29 
    Error  Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE. WebApplication4 C:\Users\RMillman\source\repos\WebApplication4\WebApplication4\WebApplication4.csproj 32 

    In the output window the following error is shown:

    1>------ Rebuild All started: Project: WebApplication4, Configuration: Debug Any CPU ------
    1>WebApplication4 -> C:\Users\RMillman\source\repos\WebApplication4\WebApplication4\bin\Debug\netcoreapp2.2\WebApplication4.dll
    1>WebApplication4 -> C:\Users\RMillman\source\repos\WebApplication4\WebApplication4\bin\Debug\netcoreapp2.2\WebApplication4.Views.dll
    1>'node' is not recognized as an internal or external command,
    1>operable program or batch file.
    1>C:\Users\RMillman\source\repos\WebApplication4\WebApplication4\WebApplication4.csproj(29,5): warning MSB3073: The command "node --version" exited with code 9009.
    1>C:\Users\RMillman\source\repos\WebApplication4\WebApplication4\WebApplication4.csproj(32,5): error : Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE.
    1>Done building project "WebApplication4.csproj" -- FAILED.
    ========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

    I would think that the project generated from the template should be buildable.  What am I doing wrong?

    Friday, July 26, 2019 7:13 PM

Answers

  • Hi R Millman,

    Thanks for your feedback. Sorry for explain it to you too simple.

    #Does that mean that the project template should install the NodeJS component and it does not.  Or does that mean that the component is not needed?

    >> If you want to use a project that based on node.js template, you have to install the workload "Node.js  development". While you do not need to create the project based on node.js template, you do not install it. The Workolad includes these tools:

    #Since this is the dafault Angular project, where within this project is nodeJs actually used/needed?

    >> The Web Application based on Angular need to install the Node.js because it needs to use its NPM toolkit for debugging,testing and so on.

    #What specific module should the project template install to allow everything to work?

    >>l recommend that you install the 10.16.0 version and make sure that your operation system is 64bit. When you installing the installation package, please follow the default steps. And do not forget to choose the module "Add to PATH".

    Any feedback will be expected.

    Best Regards,

    Perry



    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Tuesday, July 30, 2019 8:15 AM

All replies

  • Hi friend,

    Welcome to the MSDN forum.

    According to your description, l have just created a default web application by using Angular. Unfortunately, when l building the project, it throws an error as yours. To target the issue, l open the .csproj file and find something like this:

    <Target Name="DebugEnsureNodeEnv" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('$(SpaRoot)node_modules') ">
        <!-- Ensure Node.js is installed -->
        <Exec Command="node --version" ContinueOnError="true">
          <Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
        </Exec>
        <Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
        <Message Importance="high" Text="Restoring dependencies using 'npm'. This may take several minutes..." />
        <Exec WorkingDirectory="$(SpaRoot)" Command="npm install" />
      </Target>
     

    It seems that it is the problem of default project template. To solve it, installing the program is necessary:

      1. download the program from http://nodejs.org/

      2. restart your IDE or developer prompt

    l hope it could help you.

    Best Regards,

    Perry



    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Monday, July 29, 2019 10:14 AM
  • You indicate that it is a problem with the project template.  Does that mean that the project template should install the NodeJS component and it does not.  Or does that mean that the component is not needed?  Since this is the default Angular project,  where within this project is nodeJs actually used/needed?  When I navigate to http://nodejs.org/, there are multiple options as to what to install.  What specific module should the project template install to allow everything to work?

    Monday, July 29, 2019 9:25 PM
  • Hi R Millman,

    Thanks for your feedback. Sorry for explain it to you too simple.

    #Does that mean that the project template should install the NodeJS component and it does not.  Or does that mean that the component is not needed?

    >> If you want to use a project that based on node.js template, you have to install the workload "Node.js  development". While you do not need to create the project based on node.js template, you do not install it. The Workolad includes these tools:

    #Since this is the dafault Angular project, where within this project is nodeJs actually used/needed?

    >> The Web Application based on Angular need to install the Node.js because it needs to use its NPM toolkit for debugging,testing and so on.

    #What specific module should the project template install to allow everything to work?

    >>l recommend that you install the 10.16.0 version and make sure that your operation system is 64bit. When you installing the installation package, please follow the default steps. And do not forget to choose the module "Add to PATH".

    Any feedback will be expected.

    Best Regards,

    Perry



    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Tuesday, July 30, 2019 8:15 AM
  • Thanks for the info and the details.  When I installed Visual Studio 2019, I chose the node.js development workload, as outlined in my first/original post.  It appears that the tools were not properly installed at that time.  Is that correct? Is that a bug?  Additionally, I would think that if the tools should have been installed with the appropriate workload, then the error message should not suggest installing from the nodejs.org website, but should suggest installing the appropriate workload (Assuming that is the recommended source of installing the tools.)

    Thanks Again,

    Thursday, August 1, 2019 1:38 PM
  • Hi R Millman,

    #It appears that the tools wre not properly installed at that time. Is that correct? Is that a bug?

    >> It is not what you said like that. It’s just that when you build an web application based on Angular and choose the Debug Configuration, VS lacks a component and Microsoft gives the solution.And the Microsoft gives the description as l provided in the first reply Maybe this way is not very satisfactory for you.

    #Additionally, I would think that if the tools should have been installed with the appropriate workload, then the error message should not suggest installing from the nodejs.org website, but should suggest installing the appropriate workload

    >> l have found that the Node.js Development includes such components:

    The tool is really not in this workload. If the tools we need is installed in the Workloads, there will be no problems. You can make a feedback in"Help"->"Send Feedback"->"Report a Problem" to raise your proposal.

    Best Regards,

    Perry


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com





    Friday, August 2, 2019 9:08 AM
  •  What is the work around now?

    I do have the same issue and I get stuck.

    Thank you.

    Thursday, October 17, 2019 8:56 AM