The NPM script 'start' exited without indicating that the Angular CLI was listening for requests

前端 未结 8 1879
伪装坚强ぢ
伪装坚强ぢ 2020-12-03 06:36

I\'m attempting to start an .NET Core 2/Angular 6 SPA. I created an Angular 5 Application using "dotnet new angular" then proceeded to upgrade using this guide fro

相关标签:
8条回答
  • 2020-12-03 06:50

    In my case, I've removed following application setting from the azure web app and site was started working.

    Key: ASPNETCORE_ENVIRONMENT Value: Development

    Spent several days to figure out the issue :)

    0 讨论(0)
  • 2020-12-03 06:50

    I was trying to get a GitHub project working from scratch. These are the things I did to do that:

    • Download and install NodeJS: https://nodejs.org/en/download
    • Download any AngularJS project from GitHub
    • Run a command prompt and navigate to the "client-app" folder: dotnet new angular -o "C:\Users\me\OneDrive\Documents\Visual Studio 2017\Projects\myproject\myproject-dev\myproject-client-app" --force
    • Enter command: npm install -g @angular/cli
    • Enter command: npm build fix
    • Enter command: npm run ng
    • Enter command: npm start
    • Enter command: ng start --extract-css

    (I didn't actually need to enter this last command, since npm start initiated this command for my project, but might not always be the case...)

    In 'Startup.cs' file, replace

    spa.UseAngularCliServer(..)
    

    with

    spa.UseProxyToSpaDevelopmentServer("http://localhost:4200");
    

    Then F5 to start the ASP .NET Core project as we normally do to start debugging the application.

    After all of that, the project should run.

    0 讨论(0)
  • 2020-12-03 06:53

    For me this and the followings are solved the issue: https://github.com/angular/angular-cli/issues/10666

    And also you need to edit your package.json file and remove the --extractCss parameter from the start and build property. from:

    "scripts": {
        "ng": "ng",
        "start": "ng serve --extract-css",
        "build": "ng build --extract-css",
    

    to:

    "scripts": {
        "ng": "ng",
        "start": "ng serve",
        "build": "ng build",
    
    0 讨论(0)
  • 2020-12-03 06:56

    If the above solution does not work, you can try the following which worked for me.

    Scenario: Transferred working VS 2017 solution: core web api & angular spa projects to newly installed pc; gave me the above error.

    Solution: After installing node.js workloads via visual studio installer, node.js for windows (https://nodejs.org/en/download/) and the necessary windows features for IIS; I was back on track.

    The main installation is the node.js for visual studio and windows (which has npm included), had to install both for it to work. Probably the paths config for command prompt....

    0 讨论(0)
  • 2020-12-03 06:57

    Both Joe and Jays solutions work. To use the default template configuration without code changes you just need to install node.js for windows as Jay stated above and then restart VS. https://nodejs.org/en/download/

    An excellent tutorial on creating, configuring and deploying Core Angular projects with vs and vscode here . Includes IIS setup as well. https://www.codeproject.com/Articles/1250961/Deploying-an-Angular-Application-with-ASP-NET-Core

    0 讨论(0)
  • 2020-12-03 07:01

    VS 2019 - Error resolved by navigating to ClientApp folder and running npm install. Make sure you have npm installed on your system along with Angular Cli. Incase having trouble installing Angular Cli you can change script from ng serve to npm run start in package.json file.

    0 讨论(0)
提交回复
热议问题