Cannot read property 'some' of undefined
See original GitHub issue🐞 Bug report
What modules are related to this issue?
- express-engine
Is this a regression?
It worked with version 8
Description
ng add @nguniversal/express-engine@9.1.1 --client-project={{project_id}} Installing packages for tooling via npm. Installed packages for tooling via npm. Cannot read property ‘some’ of undefined
🌍 Your Environment
$ ng version
Angular CLI: 9.1.9
Node: 12.18.0
OS: linux x64
Angular: 9.1.11
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.901.9
@angular-devkit/build-angular 0.901.9
@angular-devkit/build-optimizer 0.901.9
@angular-devkit/build-webpack 0.901.9
@angular-devkit/core 9.1.9
@angular-devkit/schematics 9.1.9
@angular/cdk 9.1.3
@angular/cli 9.1.9
@angular/fire 5.4.2
@angular/material 9.1.3
@ngtools/webpack 9.1.9
@nguniversal/common 9.1.1
@nguniversal/express-engine 9.1.1
@schematics/angular 9.1.9
@schematics/update 0.901.9
rxjs 6.5.5
typescript 3.9.5
webpack 4.43.0
Issue Analytics
- State:
- Created 3 years ago
- Comments:9
Top Results From Across the Web
Cannot Read Property of Undefined in JavaScript - Rollbar
What Causes TypeError: Cannot Read Property of Undefined. Undefined means that a variable has been declared but has not been assigned a value....
Read more >TypeError: Cannot read property 'some' of undefined
javascript - I keep getting this error "TypeError: Cannot read property 'some' of undefined" - Stack Overflow. Stack Overflow for Teams – Start ......
Read more >Uncaught TypeError: Cannot read property of undefined In
JavaScript TypeError is thrown when an operand or argument passed to a function is incompatible with the type expected by that operator or...
Read more >[2.6.0] TypeError: Cannot read property 'some' of undefined ...
Description Just tried to update apollo-server-express from 2.5.1 → 2.6.0 but it's failing with the following: TypeError: Cannot read ...
Read more >Uncaught TypeError: Cannot read property 'some' of undefined
Uncaught TypeError : Cannot read property of undefined error is probably easiest to understand from the perspective of undefined, since undefined ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I got that error too. After doing some modifications of your code here is what I found out (in my case):
The error comes from /universal/modules/common/schematics/utils/utils.ts Specifically in the addInitialNavigation function.
It seems that you are looking for properties of the existingOptions.
existingOptions.properties.some
This is the some that breaks.
Just before the exception happens, I printed the existingOptions.escapedText which showed (in my case):
routerOptions
After doing a lookup in my project, I found only 1 place with this. In my app-routing.module.ts
Here is it:
It looks like your are not handling the ExtraOptions properly, or it might be the way I declared it.
If I roll back everything, remove my routerOptions (no options at all), then the whole process completes without any problem.
I hope this helps you fix the issue properly.
As for a quick’n’dirty fix:
if (existingOptions && existingOptions.properties.some(
withif (existingOptions && existingOptions.properties && existingOptions.properties.some(
const routerOptions = existingOptions ? ts.updateObjectLiteral(
withconst routerOptions = existingOptions && existingOptions.properties ? ts.updateObjectLiteral(
After that the migration completed
Note: my app-routing.module.ts was wrong after that as my routerOptions were not used anymore. And instead it declared an initialNavigation setting. Most probably it is caused by the way I fixed the problem, So I just rolled back the changes for app-routing.module.ts, and integrated the initialNavigation: ‘enabled’
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.