Skip to content

Cannot read property 'replace' of undefined when running --aot build #3225

@cheng1994

Description

@cheng1994

Please provide us with the following information:

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)

Windows Server 2012 and Mac OSX 10.12.1

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:

angular-cli: 1.0.0-beta.20-4
node: 6.9.1
os: darwin x64

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.

Created using CLI

"dependencies": {
    "@angular/common": "^2.1.0",
    "@angular/compiler": "^2.1.0",
    "@angular/core": "^2.1.0",
    "@angular/forms": "^2.1.0",
    "@angular/http": "^2.1.0",
    "@angular/material": "^2.0.0-alpha.10",
    "@angular/platform-browser": "^2.1.0",
    "@angular/platform-browser-dynamic": "^2.1.0",
    "@angular/router": "^3.1.0",
    "core-js": "^2.4.1",
    "jquery": "^3.1.1",
    "ms-signalr-client": "^2.2.5",
    "primeng": "^1.0.0-rc.6",
    "primeui": "^4.1.15",
    "rxjs": "5.0.0-beta.12",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.6.23"
  },
  "devDependencies": {
    "@angular/compiler-cli": "^2.1.0",
    "@types/jasmine": "^2.2.30",
    "@types/node": "^6.0.42",
    "angular-cli": "1.0.0-beta.20-4",
    "codelyzer": "~1.0.0-beta.3",
    "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",
    "webdriver-manager": "10.2.5"
  }

The log given by the failure.

Normally this include a stack trace and some more information.

ERROR in ./src/app/app.module.ngfactory.ts
Module build failed: TypeError: Cannot read property 'replace' of undefined
    at Object.normalizeSlashes (/Users/gordonchen/Documents/Work/Angular-2-Web/node_modules/typescript/lib/typescript.js:1771:20)
    at writeReferencePath (/Users/gordonchen/Documents/Work/Angular-2-Web/node_modules/typescript/lib/typescript.js:37236:90)
    at /Users/gordonchen/Documents/Work/Angular-2-Web/node_modules/typescript/lib/typescript.js:35750:29
    at Object.forEach (/Users/gordonchen/Documents/Work/Angular-2-Web/node_modules/typescript/lib/typescript.js:1115:30)
    at /Users/gordonchen/Documents/Work/Angular-2-Web/node_modules/typescript/lib/typescript.js:35742:20
    at Object.forEach (/Users/gordonchen/Documents/Work/Angular-2-Web/node_modules/typescript/lib/typescript.js:1115:30)
    at emitDeclarations (/Users/gordonchen/Documents/Work/Angular-2-Web/node_modules/typescript/lib/typescript.js:35735:12)
    at getDeclarationDiagnosticsFromFile (/Users/gordonchen/Documents/Work/Angular-2-Web/node_modules/typescript/lib/typescript.js:35699:13)
    at onSingleFileEmit (/Users/gordonchen/Documents/Work/Angular-2-Web/node_modules/typescript/lib/typescript.js:7569:13)
    at Object.forEachExpectedEmitFile (/Users/gordonchen/Documents/Work/Angular-2-Web/node_modules/typescript/lib/typescript.js:7542:21)
    at Object.getDeclarationDiagnostics (/Users/gordonchen/Documents/Work/Angular-2-Web/node_modules/typescript/lib/typescript.js:35695:12)
    at /Users/gordonchen/Documents/Work/Angular-2-Web/node_modules/typescript/lib/typescript.js:45673:27
    at runWithCancellationToken (/Users/gordonchen/Documents/Work/Angular-2-Web/node_modules/typescript/lib/typescript.js:45468:24)
    at getDeclarationDiagnosticsWorker (/Users/gordonchen/Documents/Work/Angular-2-Web/node_modules/typescript/lib/typescript.js:45669:20)
    at Object.getDeclarationDiagnostics (/Users/gordonchen/Documents/Work/Angular-2-Web/node_modules/typescript/lib/typescript.js:45457:24)
    at _transpile (/Users/gordonchen/Documents/Work/Angular-2-Web/node_modules/@ngtools/webpack/src/loader.js:92:29)
    at /Users/gordonchen/Documents/Work/Angular-2-Web/node_modules/@ngtools/webpack/src/loader.js:128:26
    at process._tickCallback (internal/process/next_tick.js:103:7)
 @ ./src/main.ts 4:0-64
 @ multi main

Mention any other details that might be useful.

Error occurs twice both on a module.ngfactory.ts when running with --aot only

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