Skip to content

AOT Build Errors with "Cannot read property 'transitiveModules' of undefined" #2917

Closed

Description

@mprahl

OS

macOS Sierra

Versions

angular-cli: 1.0.0-beta.18
node: 6.7.0
os: darwin x64

Repro steps

  1. Run ng new angular2-temp
  2. Run cd angular2-temp
  3. Run ng build --aot

The log given by the failure

wlan-196-101:angular2-temp mprahl$ ng build --aot
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
  0% compilingCannot read property 'transitiveModules' of undefined
TypeError: Cannot read property 'transitiveModules' of undefined
    at /Users/mprahl/git/angular2-temp/node_modules/@angular/compiler/bundles/compiler.umd.js:13042:22
    at Array.forEach (native)
    at analyzeNgModules (/Users/mprahl/git/angular2-temp/node_modules/@angular/compiler/bundles/compiler.umd.js:13041:24)
    at OfflineCompiler.compileModules (/Users/mprahl/git/angular2-temp/node_modules/@angular/compiler/bundles/compiler.umd.js:13115:20)
    at CodeGenerator.codegen (/Users/iminar/Dev/angular/modules/@angular/compiler-cli/src/codegen.ts:71:26)
    at AotPlugin._make (/Users/mprahl/git/angular2-temp/node_modules/@ngtools/webpack/src/plugin.js:186:43)
    at Compiler.<anonymous> (/Users/mprahl/git/angular2-temp/node_modules/@ngtools/webpack/src/plugin.js:151:75)
    at Compiler.applyPluginsParallel (/Users/mprahl/git/angular2-temp/node_modules/tapable/lib/Tapable.js:156:14)
    at Compiler.<anonymous> (/Users/mprahl/git/angular2-temp/node_modules/webpack/lib/Compiler.js:463:8)
    at Compiler.applyPluginsAsync (/Users/mprahl/git/angular2-temp/node_modules/tapable/lib/Tapable.js:73:70)
    at Compiler.compile (/Users/mprahl/git/angular2-temp/node_modules/webpack/lib/Compiler.js:456:7)
    at Compiler.<anonymous> (/Users/mprahl/git/angular2-temp/node_modules/webpack/lib/Compiler.js:219:10)
    at Compiler.readRecords (/Users/mprahl/git/angular2-temp/node_modules/webpack/lib/Compiler.js:367:10)
    at Compiler.<anonymous> (/Users/mprahl/git/angular2-temp/node_modules/webpack/lib/Compiler.js:216:9)
    at next (/Users/mprahl/git/angular2-temp/node_modules/tapable/lib/Tapable.js:81:11)
    at Compiler.<anonymous> (/Users/mprahl/git/angular2-temp/node_modules/webpack/lib/CachePlugin.js:34:58)
    at Compiler.applyPluginsAsync (/Users/mprahl/git/angular2-temp/node_modules/tapable/lib/Tapable.js:85:13)
    at Compiler.<anonymous> (/Users/mprahl/git/angular2-temp/node_modules/webpack/lib/Compiler.js:213:8)
    at next (/Users/mprahl/git/angular2-temp/node_modules/tapable/lib/Tapable.js:81:11)
    at Compiler.<anonymous> (/Users/mprahl/git/angular2-temp/node_modules/webpack/lib/node/NodeEnvironmentPlugin.js:23:3)
    at Compiler.applyPluginsAsync (/Users/mprahl/git/angular2-temp/node_modules/tapable/lib/Tapable.js:85:13)
    at Compiler.run (/Users/mprahl/git/angular2-temp/node_modules/webpack/lib/Compiler.js:210:7)
    at /Users/mprahl/git/angular2-temp/node_modules/angular-cli/tasks/build-webpack.js:26:29
    at Class.run (/Users/mprahl/git/angular2-temp/node_modules/angular-cli/tasks/build-webpack.js:25:16)
    at Class.run (/Users/mprahl/git/angular2-temp/node_modules/angular-cli/commands/build.js:50:26)
    at Class.<anonymous> (/Users/mprahl/git/angular2-temp/node_modules/angular-cli/lib/models/command.js:152:17)
    at tryCatch (/Users/mprahl/git/angular2-temp/node_modules/rsvp/dist/lib/rsvp/-internal.js:215:12)
    at invokeCallback (/Users/mprahl/git/angular2-temp/node_modules/rsvp/dist/lib/rsvp/-internal.js:230:13)
    at publish (/Users/mprahl/git/angular2-temp/node_modules/rsvp/dist/lib/rsvp/-internal.js:198:7)
    at flush (/Users/mprahl/git/angular2-temp/node_modules/rsvp/dist/lib/rsvp/asap.js:85:5)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

Activity

  1. deebloo commented on Oct 27, 2016

    @deebloo
    Contributor

    this seems to be a dependency problem. still investigating though

  2. deebloo commented on Oct 27, 2016

    @deebloo
    Contributor

    @filipesilva could this be another example where a dep of a dep is updating and causing this to break?

  3. deebloo commented on Oct 27, 2016

    @deebloo
    Contributor

    @mprahl try adding "@angular/compiler-cli": "2.1.1" to you dev dependencies and fixing compiler to 2.1.1. that should work for now.

  4. mprahl commented on Oct 27, 2016

    @mprahl
    Author

    @deebloo, after npm install with the package in packages.json, it says:

    ├── UNMET PEER DEPENDENCY @angular/compiler@2.1.1
    ├── @angular/compiler-cli@2.1.1 
    └── UNMET PEER DEPENDENCY @angular/core@2.1.2
    
    npm WARN @angular/compiler@2.1.1 requires a peer of @angular/core@2.1.1 but none was installed.
    npm WARN @angular/compiler-cli@2.1.1 requires a peer of @angular/core@2.1.1 but none was installed.
    npm WARN @angular/platform-browser-dynamic@2.1.2 requires a peer of @angular/compiler@2.1.2 but none was installed.
    npm WARN @angular/platform-server@2.1.2 requires a peer of @angular/compiler@2.1.2 but none was installed.
    

    Thanks for the help.

    Edit: Updated with correct output

  5. miguelramos commented on Oct 27, 2016

    @miguelramos

    @deebloo just tried to add "@angular/compiler-cli": "2.1.1", and got the same error as @mprahl, not about the peer dependency but this issue. @mprahl look to "".

  6. mprahl commented on Oct 27, 2016

    @mprahl
    Author

    @deebloo @miguelramos I ended up getting it working with specific pinning of the versions.
    I'm not sure if this is the correct way, but this is my package.json:

    {
      "name": "angular2-temp",
      "version": "0.0.0",
      "license": "MIT",
      "angular-cli": {},
      "scripts": {
        "start": "ng serve",
        "lint": "tslint \"src/**/*.ts\"",
        "test": "ng test",
        "pree2e": "webdriver-manager update",
        "e2e": "protractor"
      },
      "private": true,
      "dependencies": {
        "@angular/common": "2.1.1",
        "@angular/compiler": "2.1.1",
        "@angular/core": "2.1.1",
        "@angular/forms": "2.1.1",
        "@angular/http": "2.1.1",
        "@angular/platform-browser": "2.1.1",
        "@angular/platform-browser-dynamic": "2.1.1",
        "@angular/router": "3.1.1",
        "core-js": "^2.4.1",
        "rxjs": "5.0.0-beta.12",
        "ts-helpers": "^1.1.1",
        "zone.js": "^0.6.23"
      },
      "devDependencies": {
        "@types/jasmine": "^2.2.30",
        "@types/node": "^6.0.42",
        "angular-cli": "1.0.0-beta.18",
        "codelyzer": "1.0.0-beta.1",
        "jasmine-core": "2.4.1",
        "jasmine-spec-reporter": "2.5.0",
        "karma": "1.2.0",
        "karma-chrome-launcher": "^2.0.0",
        "karma-cli": "^1.0.1",
        "karma-jasmine": "^1.0.2",
        "karma-remap-istanbul": "^0.2.1",
        "protractor": "4.0.9",
        "ts-node": "1.2.1",
        "tslint": "3.13.0",
        "typescript": "~2.0.3",
        "@angular/compiler-cli": "2.1.1"
      }
    }
    
  7. miguelramos commented on Oct 27, 2016

    @miguelramos

    @mprahl nice. you fixed the versions! but the problem seems an update on new angular versions.

  8. miguelramos commented on Oct 27, 2016

    @miguelramos

    @mprahl i've just tried with your fixed versions and got the same error.

  9. mprahl commented on Oct 27, 2016

    @mprahl
    Author

    Interestingly enough, I tried pinning to 2.1.2 as such:

    {
      "name": "angular2-temp",
      "version": "0.0.0",
      "license": "MIT",
      "angular-cli": {},
      "scripts": {
        "start": "ng serve",
        "lint": "tslint \"src/**/*.ts\"",
        "test": "ng test",
        "pree2e": "webdriver-manager update",
        "e2e": "protractor"
      },
      "private": true,
      "dependencies": {
        "@angular/common": "2.1.2",
        "@angular/compiler": "2.1.2",
        "@angular/core": "2.1.2",
        "@angular/forms": "2.1.2",
        "@angular/http": "2.1.2",
        "@angular/platform-browser": "2.1.2",
        "@angular/platform-browser-dynamic": "2.1.2",
        "@angular/router": "3.1.2",
        "core-js": "^2.4.1",
        "rxjs": "5.0.0-beta.12",
        "ts-helpers": "^1.1.1",
        "zone.js": "^0.6.23"
      },
      "devDependencies": {
        "@types/jasmine": "^2.2.30",
        "@types/node": "^6.0.42",
        "angular-cli": "1.0.0-beta.18",
        "codelyzer": "1.0.0-beta.1",
        "jasmine-core": "2.4.1",
        "jasmine-spec-reporter": "2.5.0",
        "karma": "1.2.0",
        "karma-chrome-launcher": "^2.0.0",
        "karma-cli": "^1.0.1",
        "karma-jasmine": "^1.0.2",
        "karma-remap-istanbul": "^0.2.1",
        "protractor": "4.0.9",
        "ts-node": "1.2.1",
        "tslint": "3.13.0",
        "typescript": "~2.0.3",
        "@angular/compiler-cli": "2.1.2"
      }
    }
    

    I get the original error when running ng build --aot.

  10. mprahl commented on Oct 27, 2016

    @mprahl
    Author

    @miguelramos did you delete your "node_modules" folder before doing npm install again?

  11. miguelramos commented on Oct 27, 2016

    @miguelramos

    yeap! I'm trying with a different node version now.

  12. miguelramos commented on Oct 27, 2016

    @miguelramos

    With node v6.7 got the same issue. Even use yarn to lock versions but same error as yours above.
    yarn.lock.zip

  13. mprahl commented on Oct 27, 2016

    @mprahl
    Author

    @miguelramos I just tried it again, and it still worked. Maybe @deebloo has an idea.

  14. deebloo commented on Oct 28, 2016

    @deebloo
    Contributor

    There was just a PR opened that should fix this. In the meantime pinning the versions of angular should work.

  15. deebloo commented on Oct 28, 2016

    @deebloo
    Contributor

    Also the peer dependency warnings shouldnt keep the app from working

  16. mprahl commented on Oct 28, 2016

    @mprahl
    Author

    @deebloo Thanks for the help.

    The PR being referred to is: #2919

  17. added a commit that references this issue on Oct 28, 2016
    b50c121
  18. angular-automatic-lock-bot commented on Sep 6, 2019

    @angular-automatic-lock-bot

    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.

  19. locked and limited conversation to collaborators on Sep 6, 2019
  20. added a commit that references this issue on May 29, 2026
    a8ba49f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions