Comments (19)
I also think this can be caused by multiple copies of @uirouter
libraries in your node_modules
Try running:
yarn why @uirouter/core
yarn why @uirouter/angular
yarn why @uirouter/angularjs
yarn why @uirouter/angular-hybrid
or
npm ls @uirouter/core
npm ls @uirouter/angular
npm ls @uirouter/angularjs
npm ls @uirouter/angular-hybrid
Look for any uirouter packages with two different versions listed.
from core.
for angularjs/angular-hybrid when uirouter/[email protected] is explicitly installed, exactly this error will happen!
Only works with @uirouter/[email protected]
from core.
@eydrian or @mansevmann did you ever solve this?
from core.
I had the same problem.
npm ls @uirouter/core
Output:
[email protected]
+-- @uirouter/[email protected]
| `-- @uirouter/[email protected]
+-- @uirouter/[email protected]
| `-- @uirouter/[email protected]
`-- @uirouter/[email protected]
`-- @uirouter/[email protected] deduped
As of npm cli v8.3.0 (2021-12-09) this can be solved using the overrides
field of package.json
First add an explicit install of @uirouter/core
. I used version 6.0.8
because I am not sure if the latest version 6.0.9
is supported on @uirouter/angularjs
.
npm i @uirouter/[email protected] --P -E
Your package.json
should now have this line added to it.
"@uirouter/core": "6.0.8",
Next specify that this installed version of @uirouter/core
should be used by the dependent libraries. Manually update your package.json
and add/update the overrides
section.
"overrides": {
"@uirouter/rx": {
"@uirouter/core": "$@uirouter/core"
},
"@uirouter/angular": {
"@uirouter/core": "$@uirouter/core"
}
}
Run your install one more time.
npm i
And finally check the dependent versions one last time.
npm ls @uirouter/core
[email protected]
+-- @uirouter/[email protected] overridden
| `-- @uirouter/[email protected] deduped
+-- @uirouter/[email protected]
| `-- @uirouter/[email protected] deduped
+-- @uirouter/[email protected] overridden
`-- @uirouter/[email protected] overridden
`-- @uirouter/[email protected] deduped
from core.
Hi @marius-hi ,
services.$q
should be automatically assigned before each test by the test framework. Try to inject the UIRouter
class (or AngularJS $uiRouter
) before each test to cause the initialization code to run.
from core.
Most probably this issue is caused by multiple copies of @uirouter:
├── @uirouter/[email protected]
├── @uirouter/[email protected]
└─┬ @uirouter/[email protected]
└── @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?
from core.
it is expected to have all four of those packages, as long as none are duplicated.
from core.
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"
from core.
@eydrian @mansevmann can you show the output of yarn why @uirouter/core
or npm ls @uirouter/core
please
from core.
[email protected] /PATH_TO_REPO
├─┬ @uirouter/[email protected]
│ └── @uirouter/[email protected] deduped
├─┬ @uirouter/[email protected]
│ └── @uirouter/[email protected] deduped
├── @uirouter/[email protected]
├─┬ @uirouter/[email protected]
│ └── @uirouter/[email protected] deduped
└─┬ @uirouter/[email protected]
└── @uirouter/[email protected] deduped
from core.
nope
from core.
haha and now ? I have the same problem apparently
from core.
I don't know if this is it. but apparently
ui-router/angularjs
uses lib-esm which uses lib-esm for import coreservices
ui-router/angular
uses fesm2015 and so uses llib for import coreservice
so for Angular coreservice
was never init
from core.
Probably due to my project which looks like frankenstein monster. With this configuration in webpack it seems to solve the problem
{
test: /\.mjs$/,
include: /node_modules/,
type: 'javascript/auto',
resolve: { mainFields: ['es2015', 'browser', 'module', 'main'] }, // <-- this ligne
},
apparently the resolve.mainFields that I added globally is not taken into account I have to give it again for the mjs.
now core lib-esm
is loaded in both cases. and I no longer have this error
from core.
I use pnpm to install and run start. It fails with error: cannot read properties of undefined (reading 'when')
so i remove node_modules and use yarn.
It works fine.
from core.
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: this.promise = this.resolved ? services.$q.when(this.data) : undefined;
Almost looks like Resolvable is not able to get any services from my AngularJs. Any idea why?
from core.
Had this problem on angularJS+Angular hybrid project because of incorrect require() statements. I had to install @angular-builders/custom-webpack
and set such a config for template loading of old JS:
module: {
rules: [
{
test: /\.html$/,
type: 'asset/source',
include: [
path.resolve(__dirname, "YourParentPathToLegacyTemplates"),
],
}
]
}
And I had to change require statements from require("raw-loader!../path-to-template/template.html").default
to require("../path-to-template/template.html")
No loader + no .default at the end of the statement
It solved my problem, tested on Angular 12 and 13
from core.
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:
this.promise = this.resolved ? services.$q.when(this.data) : undefined;
Almost looks like Resolvable is not able to get any services from my AngularJs. Any idea why?
@jozzeed Have you been able to resolve this? I'm having the same issue when adding 'ui.router.upgrade' to my angularjs module.
from core.
For anyone that is still facing this issue, fixed it by also updating uirouter/angularjs from v 1.0.30 to 1.1.0
from core.
Related Issues (20)
- silenceUncaughtInPromise does not catch onBefore transitions in angular 1.7 HOT 2
- License clash MIT vs CC BY-SA 3.0 HOT 2
- @uirouter/react 0.8.9 not finding UIRouter HOT 1
- Any plan for Svelte 3? HOT 7
- Can't compile angular 8 under typescript "~3.5.3" HOT 3
- Version 6.0.2 breaks using ui-router core on Node.js without a browser HOT 1
- Can't bootstrap a hybrid application in Angular 8 due to commonservices being undefined HOT 6
- string parameters are url encoding issue HOT 5
- is AOT supported? HOT 1
- Ability to set defaultHrefOpts globally HOT 3
- Ugrading to uirouter1.x and installed ui-router-core and ui-router-angularjs ,doesnt support legacy code base HOT 1
- `inherit` is documented as having the wrong default value HOT 1
- Child states their childs, show the parent component HOT 3
- Set uiOptions.reload of [uiSref] to a future load state name lead to error at first load HOT 1
- license issue HOT 1
- How to lazy load with chunks HOT 1
- Support Ivy partial compilation HOT 10
- `ParamDeclaration.inherit = false` is ignored by `$state.href()`
- Issue with StateParams
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from core.