-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot read property 'when' of undefined #671
Comments
Hi @marius-hi ,
|
I also think this can be caused by multiple copies of Try running:
or
Look for any uirouter packages with two different versions listed. |
Most probably this issue is caused by multiple copies of @uirouter: ├── @uirouter/[email protected] What is the possible solution to prevent this issue as we will still need to rely on Angular-hybrid and AngularJs for some time until the project is fully upgraded to Angular? |
it is expected to have all four of those packages, as long as none are duplicated. |
for angularjs/angular-hybrid when uirouter/[email protected] is explicitly installed, exactly this error will happen! |
It's true what @eydrian states. Version @uirouter/[email protected] breaks our teamcity build with the error message of "Cannot read property 'when' of undefined" |
@eydrian @mansevmann can you show the output of |
|
@eydrian or @mansevmann did you ever solve this? |
nope |
haha and now ? I have the same problem apparently |
I don't know if this is it. but apparently |
Probably due to my project which looks like frankenstein monster. With this configuration in webpack it seems to solve the problem
apparently the resolve.mainFields that I added globally is not taken into account I have to give it again for the mjs. |
I use pnpm to install and run start. It fails with |
Hi, I am having a similar issue but in my actual live code. It works fine on angular 13's side but not in my AngularJs. As soon as I add the "ui.router.upgrade" dependency to my "app" module, I receive the following error: ERROR TypeError: Cannot read properties of undefined (reading 'when'). As others have mentioned, it comes from the following line of code: Almost looks like Resolvable is not able to get any services from my AngularJs. Any idea why? |
Had this problem on angularJS+Angular hybrid project because of incorrect require() statements. I had to install
And I had to change require statements from |
@jozzeed Have you been able to resolve this? I'm having the same issue when adding 'ui.router.upgrade' to my angularjs module. |
I had the same problem.
Output:
As of npm cli v8.3.0 (2021-12-09) this can be solved using the First add an explicit install of
Your
Next specify that this installed version of
Run your install one more time.
And finally check the dependent versions one last time.
|
For anyone that is still facing this issue, fixed it by also updating uirouter/angularjs from v 1.0.30 to 1.1.0 |
I'm running a project that uses angular hybrid with the following versions:
....
When executing unit tests I'm getting "Cannot read property 'when' of undefined" in most of the tests (karma with chai and mocha). I tried to debug and see that is pointing to node_modules/@uirouter/core/lib-esm/resolve/resolvable.js
this.promise = this.resolved ? services.$q.when(this.data) : undefined;
( https://github.com/ui-router/core/blob/master/src/resolve/resolvable.ts#L84 )If I guard against this.resolved the error is gone
this.promise = this.resolved && services ? services.$q.when(this.data) : undefined;
Could you suggest in which cases services can be undefined and if this can be fixed on master?
Should I create a pull request for it?
The text was updated successfully, but these errors were encountered: