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
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 :)
I was trying to get a GitHub project working from scratch. These are the things I did to do that:
dotnet new angular -o "C:\Users\me\OneDrive\Documents\Visual Studio 2017\Projects\myproject\myproject-dev\myproject-client-app" --force
npm install -g @angular/cli
npm build fix
npm run ng
npm start
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.
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",
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....
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
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.