angular / mobile-toolkit

Tools for building progressive web apps with Angular
MIT License
1.33k stars 176 forks source link

ng build generates dist/index.html w/ contents of 'undefined' after angular-cli beta.6 upgrade #66

Open Splaktar opened 8 years ago

Splaktar commented 8 years ago
  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OS X (Yosemite? El Capitan?)

OS X El Capitan

  1. Versions. Please run ng --version.
angular-cli: 1.0.0-beta.6
node: 4.4.3
os: darwin x64
  1. Repro steps. Was this an app that wasn't created using the CLI? What change did you do on your code? etc.

Created with beta.5 CLI with --mobile and then upgraded with ng init --mobile for beta.6. Only changes were to merge my existing app back into the files overwritten by the CLI.

Also able to reproduce this in a brand new beta.6 project by doing:

ng new testApp --mobile
ng build
  1. The log given by the failure. Normally this include a stack trace and some more information.
$ ng build
Built project successfully. Stored in "dist/".
  1. Mention any other details that might be useful.

Unfortunately there is no error output at all.

Contents of dist/index.html:

undefined

ng build --prod on a new project seems to give an error that might be helpful:

ng build --prod
⠸ BuildingEXCEPTION: Error in :0:0
ORIGINAL EXCEPTION: The selector "app-root" did not match any elements
ORIGINAL STACKTRACE:
Error: The selector "app-root" did not match any elements
    at new BaseException (/Users/splaktar/Git/tf/testApp/node_modules/@angular/platform-browser/src/facade/exceptions.js:17:23)
    at NodeDomRenderer.DomRenderer.selectRootElement (/Users/splaktar/Git/tf/testApp/node_modules/@angular/platform-browser/src/dom/dom_renderer.js:79:23)
    at DebugDomRenderer.selectRootElement (/Users/splaktar/Git/tf/testApp/node_modules/@angular/core/src/debug/debug_renderer.js:19:39)
    at DebugAppView.AppView.selectOrCreateHostElement (/Users/splaktar/Git/tf/testApp/node_modules/@angular/core/src/linker/view.js:88:41)
    at DebugAppView._View_AppComponent_Host0.createInternal (AppComponent_Host.template.js:12:21)
    at DebugAppView.AppView.create (/Users/splaktar/Git/tf/testApp/node_modules/@angular/core/src/linker/view.js:66:21)
    at DebugAppView.create (/Users/splaktar/Git/tf/testApp/node_modules/@angular/core/src/linker/view.js:259:44)
    at ComponentFactory.create (/Users/splaktar/Git/tf/testApp/node_modules/@angular/core/src/linker/component_factory.js:143:36)
    at /Users/splaktar/Git/tf/testApp/node_modules/@angular/core/src/application_ref.js:314:44
    at /Users/splaktar/Git/tf/testApp/node_modules/@angular/core/src/application_ref.js:292:26
    at ZoneDelegate.invoke (/Users/splaktar/Git/tf/testApp/node_modules/zone.js/dist/zone-node.js:281:29)
    at Object.NgZoneImpl.inner.inner.fork.onInvoke (/Users/splaktar/Git/tf/testApp/node_modules/@angular/core/src/zone/ng_zone_impl.js:45:41)
    at ZoneDelegate.invoke (/Users/splaktar/Git/tf/testApp/node_modules/zone.js/dist/zone-node.js:280:35)
    at Zone.run (/Users/splaktar/Git/tf/testApp/node_modules/zone.js/dist/zone-node.js:174:44)
    at NgZoneImpl.runInner (/Users/splaktar/Git/tf/testApp/node_modules/@angular/core/src/zone/ng_zone_impl.js:76:71)
    at NgZone.run (/Users/splaktar/Git/tf/testApp/node_modules/@angular/core/src/zone/ng_zone.js:223:66)
ERROR CONTEXT:
DebugContext {
  _view: 
   DebugAppView {
     clazz: [Function: _View_AppComponent_Host0],
     componentType: 
      RenderComponentType {
        id: 'gms-0',
        templateUrl: '',
        slotCount: 0,
        encapsulation: 0,
        styles: [] },
     type: 0,
     viewUtils: 
      ViewUtils {
        _renderer: [Object],
        _appId: 'gms',
        _nextCompTypeId: 1,
        sanitizer: DomSanitizationServiceImpl {} },
     parentInjector: 
      ReflectiveInjector_ {
        _debugContext: null,
        _constructionCounter: 40,
        _proto: [Object],
        _parent: [Object],
        _strategy: [Object] },
     declarationAppElement: null,
     cdMode: 2,
     contentChildren: [],
     viewChildren: [],
     viewContainerElement: null,
     cdState: 2,
     destroyed: false,
     ref: ViewRef_ { _view: [Circular] },
     renderer: DebugDomRenderer { _delegate: [Object] },
     staticNodeDebugInfos: [ [Object] ],
     _currentDebugContext: [Circular],
     context: {},
     _hasExternalHostElement: true,
     projectableNodes: [] },
  _nodeIndex: 0,
  _tplRow: 0,
  _tplCol: 0 }
Splaktar commented 8 years ago

I thought that this might be related to https://github.com/angular/angular-cli/pull/1042, but that does not appear to be the case.

I was able to solve this by reverting the version of angular-universal to:

    "angular2-universal":"0.100.5",

From the version provided by the angular-cli beta.6 which is:

    "angular2-universal":"0.101.5",

I also tried a newer version of universal, but saw the same behavior:

    "angular2-universal":"0.101.9",
Splaktar commented 8 years ago

I also tried with the latest of all of the angular-universal libraries, but saw the same problem:

    "@angular/platform-server": "2.0.0-rc.1",
    "@angular/service-worker": "0.2.0",
    "@angular/app-shell": "0.0.0",
    "angular-cli": "1.0.0-beta.6",
    "angular2-broccoli-prerender": "0.11.5",
    "angular2-express-engine": "0.14.1",
    "angular2-universal":"0.102.1",
    "angular2-universal-polyfills": "0.4.1",
    "codelyzer": "0.0.20",
    "ember-cli-inject-live-reload": "1.4.0",
    "jasmine-core": "2.4.1",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "0.13.22",
    "karma-chrome-launcher": "1.0.1",
    "karma-jasmine": "1.0.2",
    "preboot": "2.1.2",
    "protractor": "3.3.0",
    "ts-node": "0.7.3",
    "tslint": "3.11.0",
    "typescript": "1.8.10",
    "typings": "0.8.1"
Splaktar commented 8 years ago

Opened https://github.com/angular/universal/issues/445 to see if this is something that can be fixed on the angular-universal side or not.

yahyaKacem commented 8 years ago

This also happen to me with ng serve for a new project on ubuntu 14.04:

angular-cli: 1.0.0-beta.6
node: 6.2.1
os: linux x64

@Splaktar suggestion for downgrading "angular2-universal" to "0.100.5" seems to make it work.

Splaktar commented 8 years ago

This is also being tracked here: https://github.com/angular/angular-cli/issues/958