Azure / ng-deploy-azure

Deploy Angular apps to Azure using the Angular CLI
MIT License
79 stars 37 forks source link

Unable to deploy: An unhandled exception occurred: Project target does not exist. #101

Open septst opened 3 years ago

septst commented 3 years ago

Describe the bug I am trying to deploy a sample angular app as per the instructions given here.

To Reproduce Steps to reproduce the behavior:

  1. Follow the below steps as in to this tutorial create a new angular app
    npm install -g @angular/cli@8                    # Install the Angular CLI
    ng new iam-spa --routing=true --style=css # Generate a new Angular app
    cd <app-path>                                # Change to the app directory
    npm install @angular/material@8 @angular/cdk@8   # Install the Angular Material component library (optional, for UI)
    npm install msal @azure/msal-angular             # Install MSAL and MSAL Angular in your application
    ng generate component home                  # To add a new page (such as a home or profile page)
  2. Run ng serve to launch the app and see if it is created alright.
  3. Add ng-deploy to your project ng add @azure/ng-deploy
  4. Deploy your project to Azure. ng run iam-spa:deploy
  5. When I run the above command, I am getting the below error:

    An unhandled exception occurred: Project target does not exist. See "C:\Users\username\AppData\Local\Temp\ng-QzVaez\angular-errors.log" for further details.

I tried the same steps by creating a new service-principal with role contributor and login with it. But, no luck. Please check

My Angular.json has: { "$schema": "./node_modules/@angular/cli/lib/config/schema.json", "version": 1, "newProjectRoot": "projects", "projects": { "iam-spa": { "projectType": "application", "schematics": { "@schematics/angular:application": { "strict": true } }, "root": "", "sourceRoot": "src", "prefix": "app", "architect": { "build": { "builder": "@angular-devkit/build-angular:browser", "options": { "outputPath": "dist/iam-spa", "index": "src/index.html", "main": "src/main.ts", "polyfills": "src/polyfills.ts", "tsConfig": "tsconfig.app.json", "aot": true, "assets": [ "src/favicon.ico", "src/assets" ], "styles": [ "src/styles.css" ], "scripts": [] }, "configurations": { "production": { "fileReplacements": [ { "replace": "src/environments/environment.ts", "with": "src/environments/environment.prod.ts" } ], "optimization": true, "outputHashing": "all", "sourceMap": false, "namedChunks": false, "extractLicenses": true, "vendorChunk": false, "buildOptimizer": true, "budgets": [ { "type": "initial", "maximumWarning": "500kb", "maximumError": "1mb" }, { "type": "anyComponentStyle", "maximumWarning": "2kb", "maximumError": "4kb" } ] } } }, "serve": { "builder": "@angular-devkit/build-angular:dev-server", "options": { "browserTarget": "iam-spa:build" }, "configurations": { "production": { "browserTarget": "iam-spa:build:production" } } }, "extract-i18n": { "builder": "@angular-devkit/build-angular:extract-i18n", "options": { "browserTarget": "iam-spa:build" } }, "test": { "builder": "@angular-devkit/build-angular:karma", "options": { "main": "src/test.ts", "polyfills": "src/polyfills.ts", "tsConfig": "tsconfig.spec.json", "karmaConfig": "karma.conf.js", "assets": [ "src/favicon.ico", "src/assets" ], "styles": [ "src/styles.css" ], "scripts": [] } }, "lint": { "builder": "@angular-devkit/build-angular:tslint", "options": { "tsConfig": [ "tsconfig.app.json", "tsconfig.spec.json", "e2e/tsconfig.json" ], "exclude": [ "**/node_modules/**" ] } }, "e2e": { "builder": "@angular-devkit/build-angular:protractor", "options": { "protractorConfig": "e2e/protractor.conf.js", "devServerTarget": "iam-spa:serve" }, "configurations": { "production": { "devServerTarget": "iam-spa:serve:production" } } } } } }, "defaultProject": "iam-spa" }

Expected behavior The app should be deployed into Azure

Desktop (please complete the following information):

Please let me know what I am missing. Thanks much!