question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot read property 'toJSON' of undefined

See original GitHub issue

I have a project here that uses ngc. However, when I compile the project using TS 2.2.2 and the command ./node_modules/.bin/ngc -p src/lib/tsconfig.json I get the following error…

TypeError: Cannot read property 'toJSON' of undefined
    at Object.sourceMapGeneratorToConsumer (.../node_modules/tsickle/build/src/source_map_utils.js:65:42)
    at TsickleCompilerHost.combineSourceMaps (.../flex-layout/node_modules/tsickle/build/src/tsickle_compiler_host.js:167:74)
    at TsickleCompilerHost.writeFile (.../flex-layout/node_modules/tsickle/build/src/tsickle_compiler_host.js:111:28)
    at Object.writeFile (.../flex-layout/node_modules/typescript/lib/typescript.js:64240:132)
    at Object.writeFile (.../flex-layout/node_modules/typescript/lib/typescript.js:9020:14)
    at printSourceFileOrBundle (.../flex-layout/node_modules/typescript/lib/typescript.js:61197:20)
    at emitSourceFileOrBundle (.../flex-layout/node_modules/typescript/lib/typescript.js:61155:21)
    at Object.forEachEmittedFile (.../flex-layout/node_modules/typescript/lib/typescript.js:8986:17)
    at Object.emitFiles (.../flex-layout/node_modules/typescript/lib/typescript.js:61137:12)
    at emitWorker (.../flex-layout/node_modules/typescript/lib/typescript.js:64294:33)

I would expect that this is probably related to using TS 2.2

https://github.com/angular/tsickle/pull/447

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:17 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
LucasSloancommented, Apr 3, 2017

@jrgleason @ThomasBurleson It looks like the issue is that you specify a maproot of “” in your tsconfig. Can you remove that setting?

0reactions
evmarcommented, Aug 20, 2019

This sounds like a bug in ngc.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot read property 'toJSON' of undefined
model is undefined in my backbone view. Here's my script: var TheModel = Backbone.Model.extend({ defaults: ...
Read more >
Cannot read property 'toJson' of undefined when bundling ...
1.13.1 TypeError: Cannot read property 'toJson' of undefined when ... parts are in my config.json, I either get a result or it is...
Read more >
Email not delivering with error "Cannot read property ' ...
I just ran into an error when trying to send out a newsletter: “Cannot read property 'toJSON' of null”. My Ghost install is...
Read more >
KB233002: Unable to get property 'toJson' of undefined or ...
In MicroStrategy Web, an ESRI map widget may return an error regarding 'Unable to get property 'toJson' of undefined or null reference'. This ......
Read more >
Uncaught TypeError: Cannot read property of undefined In
Uncaught TypeError : Cannot read property of undefined error occurs in Chrome when you read a property or call a method on an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found