Angular-cli: ng serve --aot is not running in 6.0.0-rc.5

Created on 19 Apr 2018  Â·  5Comments  Â·  Source: angular/angular-cli

Versions

 _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / â–³ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 6.0.0-rc.5
Node: 9.3.0
OS: darwin x64
Angular: 6.0.0-rc.5
... animations, cli, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.5.7
@angular-devkit/build-angular      0.5.7
@angular-devkit/build-optimizer    0.5.7
@angular-devkit/core               0.5.7
@angular-devkit/schematics         0.5.7
@angular/cdk                       6.0.0-rc.12
@angular/language-service          5.2.10
@angular/material                  6.0.0-rc.12
@angular/material-moment-adapter   5.2.5
@ngtools/json-schema               1.1.0
@ngtools/webpack                   6.0.0-rc.5
@schematics/angular                0.5.7
@schematics/update                 0.5.7
rxjs                               6.0.0-uncanny-rc.7
typescript                         2.7.2
webpack                            4.5.0

npm: 5.8.0
node: v9.3.0.

macOS (Sierra)

Repro steps

npm uninstall -g @angular/cli
npm cache verify
npm install -g @angular/cli@next

rm -rf node_modules dist
npm install --save-dev @angular/cli@next
npm install

Observed behavior

ng build --aot works fine, ng serve -- aot does not work,

> Unknown option: '--aot'


Desired behavior

I want to be able to run the following using npm start,

ng serve --aot --ssl --proxy-config proxy.config.json

My package.json,

{
  "name": "quickstart-angular5",
  "version": "5.0.5",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve --prod --ssl --proxy-config proxy.config.json",
    "build": "run-s build:client build:aot build:server",
    "build:client": "ng build --prod --build-optimizer --app 0",
    "build:aot": "ng build --aot --app 1",
    "build:server": "webpack -p",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e",
    "build:free": "ngm build -p src/app/typescripts/free --clean && gulp npmFree && gulp startFree && gulp onlyFree",
    "build:pro": "ngm build -p src/app/typescripts/pro --clean && gulp only-pro && gulp startPro",
    "build:all": "npm run build:free && npm run build:pro",
    "aot:build": "ng build --prod --sm=false --aot=true --output-path=dist",
    "pre-commit": "ng lint"
  },
  "private": true,
  "dependencies": {
    "@agm/core": "^1.0.0-beta.2",
    "@angular/animations": "^6.0.0-rc.0",
    "@angular/cdk": "^6.0.0-beta.5",
    "@angular/common": "^6.0.0-rc.0",
    "@angular/compiler": "^6.0.0-rc.0",
    "@angular/core": "^6.0.0-rc.0",
    "@angular/forms": "^6.0.0-rc.0",
    "@angular/http": "^6.0.0-rc.0",
    "@angular/material": "^6.0.0-beta.5",
    "@angular/material-moment-adapter": "^5.2.5",
    "@angular/platform-browser": "^6.0.0-rc.0",
    "@angular/platform-browser-dynamic": "^6.0.0-rc.0",
    "@angular/platform-server": "^5.2.10",
    "@angular/router": "^6.0.0-rc.0",
    "@auth0/angular-jwt": "^1.1.0",
    "@ng-bootstrap/ng-bootstrap": "1.0.0-beta.5",
    "@ngrx/core": "^1.2.0",
    "@ngrx/effects": "^4.1.1",
    "@ngrx/entity": "^4.1.1",
    "@ngrx/router-store": "^4.1.1",
    "@ngrx/store": "^4.1.1",
    "@ngrx/store-devtools": "^4.1.1",
    "@swimlane/ngx-datatable": "^11.3.2",
    "@types/googlemaps": "^3.30.8",
    "angular-bootstrap-md": "^5.2.3",
    "angular2-cookie": "^1.2.6",
    "angular2-jwt": "^0.2.3",
    "angular2-uuid": "^1.1.1",
    "chart.js": "^2.7.2",
    "classlist.js": "1.1.x",
    "core-js": "^2.5.3",
    "del": "3.0.x",
    "easy-pie-chart": "^2.1.7",
    "effect": "^1.0.4",
    "eslint": "^4.19.1",
    "express": "^4.16.3",
    "font-awesome": "^4.7.0",
    "g": "^2.0.1",
    "gulp": "^3.9.1",
    "gulp-rename": "1.2.x",
    "gulp-run": "1.7.x",
    "hammerjs": "^2.0.8",
    "karma-jasmine": "^1.1.1",
    "moment": "^2.22.1",
    "ng-html-util": "1.0.x",
    "ng-http-loader": "^0.6.0",
    "ng-mdb-pro": "****************",
    "ngm-cli": "0.5.x",
    "ngrx-store-freeze": "^0.2.2",
    "ngrx-store-localstorage": "^0.2.4",
    "ngrx-store-logger": "^0.2.1",
    "npm": "^5.8.0",
    "raven-js": "^3.24.1",
    "reselect": "^3.0.1",
    "rxjs": "^6.0.0-beta.1",
    "rxjs-compat": "^6.0.0-uncanny-rc.7",
    "screenfull": "^3.3.2",
    "smoothscroll-polyfill": "0.3.x",
    "stacktrace-js": "^2.0.0",
    "systemjs": "^0.20.19",
    "web-animations-js": "2.3.x",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.5.0",
    "@angular/cli": "^6.0.0-rc.5",
    "@angular/common": "^5.2.6",
    "@angular/compiler-cli": "^6.0.0-rc.0",
    "@angular/core": "^5.2.6",
    "@angular/http": "^5.2.6",
    "@angular/language-service": "^5.2.10",
    "@compodoc/compodoc": "^1.1.2",
    "@types/jasmine": "2.5.38",
    "@types/node": "^6.0.103",
    "angular-router-loader": "^0.8.3",
    "codelyzer": "~2.0.0",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.0.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "npm-run-all": "^4.1.2",
    "postcss-loader": "^2.1.3",
    "protractor": "~5.1.0",
    "ts-node": "~5.0.0",
    "tslint": "~5.9.1",
    "typescript": "^2.7.2",
    "webpack-cli": "^2.0.14",
    "webpack-node-externals": "^1.7.2"
  }
}

All 5 comments

I know that the --aot cli option was delete on serve, but @filipesilva should have a better answer for this.

But the dev-server architect support the aot option. It seems to be set to false by default, but I may be wrong here.

So you can activate aot for serve by setting your (angular.json).projects.[your project].architect.serve.options.aot to true.

      "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "poc:build",
            "aot": true
          },
          "configurations": {
            "production": {
              "browserTarget": "poc:build:production"
            }
          }
        },

Duplicate of #10304.
Resolved via angular/devkit#734

@noelmace
I got this error

Schema validation failed with the following errors:
Data path "" should NOT have additional properties(aot).

Is there documentation for the new angular.json file somewhere. Or the schema? I am getting the same error for the poll option. I am trying to use it in the example below. If I remove the "poll" option, everything else works. I need the poll option because Docker for Windows does not handle file change events properly on mounted volumes.

        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "myapp:build"
          },
          "configurations": {
            "hmr": {
              "browserTarget": "myapp:build:hmr",
              "host": "0.0.0.0",
              "watch": true,
              "poll": 500,
              "hmr": true,
              "proxyConfig": "proxy.conf.json"
            },
            "production": {
              "browserTarget": "myapp:build:production"
            }
          }
        },

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings