Error creating Angular stand alone project in Visual Studio 2022

Chris Reed (Queryon) 21 Reputation points
2022-05-20T18:15:53.097+00:00

Following this Microsoft document tutorial-asp-net-core-with-angular I am trying to create a solution with an Angular front end and c# api back end. When I click "Create" for the Angular project (using the stand alone template), I get the following error:
204130-eediz-2.jpg
I've tried uninstalling angular, force cleaning cache, and reinstalling both angular and node js (not sure that matters though). The uninstall removes the npm folder so there aren't any files left over.

I also updated VS to the latest version.

I found I can create a solution from the "ASP.NET Core with Angular" template. internet searches have given me nadda on this error. I'd appreciate any help.

Developer technologies Visual Studio Other
{count} votes

4 answers

Sort by: Most helpful
  1. MikeInSwitzerland 5 Reputation points
    2024-04-07T08:25:09.8133333+00:00

    This issue has been repeatedly reported by users over the years, and the Microsoft team has closed it each time, saying they don't have enough information.

    The big problem here is that VS2022 does not check that you have the version of Node / Angular CLI installed which it is expecting.

    And when this issue happens, it just vomits a vague error about "Version of Angular CLI was not valid" without any details about which version it was expecting (and which version you actually have installed). It also doesn't give any clues about if it needs/demands a particular value of Node.

    Given that VS2022 gives a template for letting users generate an Angular app from scratch, this is really poorly implemented. It's safest just to create the Angular app separately in VS Code and just use VS2022 for writing the WebApi service.

    (It's currently April 2024, and I'm running the latest version of VS 2022 Professional v17.9.5, and have Node 18 and 20 installed, and Angular 14.)

    1 person found this answer helpful.
    0 comments No comments

  2. Anna Xiu-MSFT 31,056 Reputation points Microsoft External Staff
    2022-05-23T08:32:22.37+00:00

    Hi @Chris Reed (Queryon) ,

    Welcome to Microsoft Q&A!

    You can run the “ng v” on an admin command prompt and check your Angular CLI and Node.js version.

    Please update your Angular CLI and Node.js to the latest stable version.
    Angular CLI v13.3.6: https://angular.io/cli
    Node v16.15.0: https://nodejs.org/en/download/

    Then, re-launch your VS2022 and try to create the project again.

    Sincerely,
    Anna
    *
    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  3. Noha Rashid Elawwad 6 Reputation points
    2022-06-03T20:33:26.42+00:00

    How is your problem now? Have you tried to repair your VS through running Visual Studio Installer > More > Repair?


  4. Martin Hagermark 0 Reputation points
    2024-12-21T15:43:36.1433333+00:00

    I got the same issue.
    I tried to reinstall Node.js, but still the same issue.

    Then I tried to install the latest version of angular cli globally...

    npm install -g @angular/cli@latest

    Then latest npm

    npm install -g npm@11.0.0

    And after that I was able to install the spa template.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.