TypeError: Cannot read property 'map' of undefined at Evaluator.evaluateNode -- No maps!

So I’m getting an error that preventing the app from finishing a build.

[13:12:49]  ngc error: TypeError: Cannot read property 'map' of undefined
    at Evaluator.evaluateNode (/Users/AUrbina/Documents/VeteranConnect2/node_modules/@angular/tsc-wrapped/src/evaluator.js:283:54)
    at /Users/AUrbina/Documents/VeteranConnect2/node_modules/@angular/tsc-wrapped/src/evaluator.js:283:89
    at Array.map (native)
    at Evaluator.evaluateNode (/Users/AUrbina/Documents/VeteranConnect2/node_modules/@angular/tsc-wrapped/src/evaluator.js:283:55)
    at maybeGetSimpleFunction (/Users/AUrbina/Documents/VeteranConnect2/node_modules/@angular/tsc-wrapped/src/collector.js:46:50)
    at /Users/AUrbina/Documents/VeteranConnect2/node_modules/@angular/tsc-wrapped/src/collector.js:242:41
    at visitEachNode (/Users/AUrbina/Documents/VeteranConnect2/node_modules/typescript/lib/typescript.js:8251:30)
    at Object.forEachChild (/Users/AUrbina/Documents/VeteranConnect2/node_modules/typescript/lib/typescript.js:8411:24)
    at MetadataCollector.getMetadata (/Users/AUrbina/Documents/VeteranConnect2/node_modules/@angular/tsc-wrapped/src/collector.js:204:12)
    at ReflectorHost.getMetadataFor (/Users/AUrbina/Documents/VeteranConnect2/node_modules/@angular/compiler-cli/src/reflector_host.js:224:43)


[13:12:49]  ngc error: Compilation failed


[13:12:49]  ngc failed:  NGC encountered an error

[13:12:49]  Error: NGC encountered an error
    at ChildProcess.<anonymous> (/Users/AUrbina/Documents/VeteranConnect2/node_modules/@ionic/app-scripts/dist/ngc.js:60:24)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:852:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)

Error running ionic app script "build": Error: NGC encountered an error

I have rxjs/add/operator/map imported everywhere map is used.

To try to isolate the problem I’ve commented out all instances of map and *ngFor, intending to work backwards but even with all of the maps and *ngFor commented out, I still get this error.

Anyone face a similar issue?

Cordova CLI: 6.3.1
Gulp version: CLI version 3.9.1
Gulp local:
Ionic Framework Version: 2.0.0-rc.0
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.1.0-beta.1
ios-deploy version: 1.8.6
ios-sim version: 5.0.8
OS: Mac OS X El Capitan
Node Version: v6.2.2
Xcode version: Xcode 8.0 Build version 8A218a

actually it got nothing to do with map, if you look at evaluator.js the error is inside
case ts.SyntaxKind.NewExpression:
so the error is in a “new” expression, in my case the error was on a line like
new AuthConfig
which I fixed by adding parentheses
new AuthConfig()

1 Like

Thanks this works for me!

I have the same issue in upload.js file
… \AppData\Roaming\npm\node_modules\ionic\node_modules\ionic-app-lib\lib\upload.js:271:18
when I type: ionic upload for using ionic view app.

1 Like

I am getting the error as well

Error: Uncaught (in promise): TypeError: Cannot read property ‘maps’ of undefined
TypeError: Cannot read property ‘maps’ of undefined
at MapDirective.createMap (http://localhost:8101/build/main.js:74608:57)
at MapDirective.ngOnInit (http://localhost:8101/build/main.js:74605:25)
at checkAndUpdateDirectiveInline (http://localhost:8101/build/main.js:11071:19)