You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Angular 10] - Function calls are not supported in decorators but 'NativeScriptRouterModule' was called #2238
Environment
Provide version numbers for the following components (information can be retrieved by running tns info in your project folder or by inspecting the package.json of the project):
ERROR in src/app/app.module.ts(10,33): Error during template compile of 'AppModule'
Function calls are not supported in decorators but 'NativeScriptRouterModule' was called in 'routesModule'
'routesModule' calls 'NativeScriptRouterModule'.
I'm also having this issue. I'm running a building a nativescript angular project where I intend to build a website, iOS and Android from the same code base. I started the project about a year ago and came back to it. First things first, I spent some time bringing all my packages up to date. However, when running ns debug ios I come across this error.
ERROR in Error during template compile of 'AppRoutingModule'
Function calls are not supported in decorators but 'NativeScriptRouterModule' was called.
Unexpected value 'undefined' imported by the module 'AppRoutingModule in /Users/user/project/src/app/app-routing.module.tns.ts'
Can't export value NativeScriptRouterModule in /Users/user/project/node_modules/@nativescript/angular/nativescript-angular.d.ts from AppRoutingModule in /Users/user/project/src/app/app-routing.module.tns.ts as it was neither declared nor imported!
Error during template compile of 'AppRoutingModule'
Function calls are not supported in decorators but 'NativeScriptRouterModule' was called.
Unexpected value 'undefined' imported by the module 'AppRoutingModule in /Users/user/project/src/app/app-routing.module.ts'
Can't export value NativeScriptRouterModule in /Users/user/project/node_modules/@nativescript/angular/nativescript-angular.d.ts from AppRoutingModule in /Users/user/project/src/app/app-routing.module.ts as it was neither declared nor imported!
Error during template compile of 'AppRoutingModule'
Function calls are not supported in decorators but 'NativeScriptRouterModule' was called.
Error during template compile of 'AppRoutingModule'
Function calls are not supported in decorators but 'NativeScriptRouterModule' was called.
It feels like a typescript error I'm not sure. Any help would be appreciated.
By upgrading to Angular 9.
The wiki said you need to make the following change:
disable Ivy by adding this to your project's tsconfig.json with the following:
"compilerOptions": {
...your various options, etc.
},
"angularCompilerOptions": {
"enableIvy": false
}
When you remove this
"angularCompilerOptions": {
"enableIvy": false
}
from your tsconfig.json file the build should work again.
I hope this also solves your issue?
@DepickereSven I need to disable Ivy, because if I enable it my application doesn't work.
If I remove angularCompilerOptions, Ivy is enabled by default but I need to disable Ivy.
Do you know how to solve this with Ivy disabled? Suggestions?
ERROR in Error during template compile of 'AppRoutingModule'
Function calls are not supported in decorators but 'NativeScriptRouterModule' was called.
@mapo80 to be honest I don't have any clue.
I can't find any information to opt-out of Ivy in Angular 10.
See Angular website: https://angular.io/guide/ivy
I made another try, I've downgraded from Ns 10 to Ns 9 but I've used NS 7 and I don't have this problem.
App doesn't start for other reasons but I don't have build problems.
I raise my hands! @NathanWalker, I'll wait for your answer.
@mapo80 I would suggest you close this issue and create a new one with your specific problem. Because your issue about "[Angular 10] - Function calls are not supported in decorators but 'NativeScriptRouterModule'" was called has been resolved.
enables ivy and I think you want Ivy, I don't think that's the issue, there is something else at play here.
I managed to work around it but I can't be specific as to what it was that I did. @mapo80 could you paste you package.json? I'm not promising to solve this but if I compare what you have with what I have, then perhaps it will remind me what I did to get around it?
Guys thanks for your help, I need to disable Ivy but if I disable something goes wrong.
To solve this issue it’s needed to make a new version of @nativescript/angular with nativescript disabled. There is a PR to disable Ivy: #2254
Hi,
Does anyone found the right fix instead of enabling Ivy ?
I'm facing also this issue and enabling Ivy is making my app running but wondering the accuracy of this procedure.
In my case the error is thrown by one of my generated lib but there is a lack of debugging to find which code block is origin of this error
Activity
DepickereSven commentedon Sep 6, 2020
I'm having the same error.
I also followed the same upgrading as you.
From Angular 8 to Angular 9 and now Angular 10.
package.json details
iOS runtime: 6.5.2
This is the specific error I'm getting
This my app-routing.module
This is the app module where I'm importing
routesModulearmourjami commentedon Sep 10, 2020
I'm also having this issue. I'm running a building a nativescript angular project where I intend to build a website, iOS and Android from the same code base. I started the project about a year ago and came back to it. First things first, I spent some time bringing all my packages up to date. However, when running
ns debug iosI come across this error.It feels like a typescript error I'm not sure. Any help would be appreciated.
My package.json
AppRoutingModule looks like this:
And it is imported into my main module like this:
My text editor highlight these lines as shown below citing that
Class NativeScriptRouterModule.forRoot(APP_ROUTES) is not an Angular Function.DepickereSven commentedon Sep 12, 2020
@mapo80 and @armourjami
By upgrading to Angular 9.
The wiki said you need to make the following change:
disable Ivy by adding this to your project's
tsconfig.jsonwith the following:When you remove this
from your
tsconfig.jsonfile the build should work again.I hope this also solves your issue?
armourjami commentedon Sep 13, 2020
Awesome thanks @DepickereSven. This does solve the issue. Thanks 😁
mapo80 commentedon Sep 14, 2020
This fixes the issue, thanks very much.
I want to understand why this workaround fixes the issue, do you know @DepickereSven?
mapo80 commentedon Sep 16, 2020
@DepickereSven I need to disable Ivy, because if I enable it my application doesn't work.
If I remove angularCompilerOptions, Ivy is enabled by default but I need to disable Ivy.
Do you know how to solve this with Ivy disabled? Suggestions?
armourjami commentedon Sep 16, 2020
@mapo80 I had the same thing and managed to fix it. Take a look at this https://stackoverflow.com/questions/63836620/nativescript-error-function-calls-are-not-supported-in-decorators-but-natives
mapo80 commentedon Sep 17, 2020
@armourjami I've checked and I have this configuration so stack overflow question doesn't solve my problem:
Suggestions? How to disable Ivy?
DepickereSven commentedon Sep 17, 2020
@mapo80 to be honest I don't have any clue.
I can't find any information to opt-out of Ivy in Angular 10.
See Angular website: https://angular.io/guide/ivy
mapo80 commentedon Sep 17, 2020
I have tried everything but can't solve the problem.
I've read this post but nothing: angular/angular#23609 (comment)
I want to say that the same code and app works without problems on Ns 6.5 and Ng 9.
Only @NathanWalker can help us!
mapo80 commentedon Sep 17, 2020
I made another try, I've downgraded from Ns 10 to Ns 9 but I've used NS 7 and I don't have this problem.
App doesn't start for other reasons but I don't have build problems.
I raise my hands! @NathanWalker, I'll wait for your answer.
mapo80 commentedon Sep 17, 2020
I've created a repo to reproduce the issue: https://github.com/mapo80/TestNs7Ng10
DepickereSven commentedon Sep 18, 2020
@mapo80 I would suggest you close this issue and create a new one with your specific problem. Because your issue about "[Angular 10] - Function calls are not supported in decorators but 'NativeScriptRouterModule'" was called has been resolved.
mapo80 commentedon Sep 18, 2020
@DepickereSven This issue is solved if Ivy is enabled, if not build continues to fail.
armourjami commentedon Sep 18, 2020
Removing the config
enables ivy and I think you want Ivy, I don't think that's the issue, there is something else at play here.
I managed to work around it but I can't be specific as to what it was that I did. @mapo80 could you paste you package.json? I'm not promising to solve this but if I compare what you have with what I have, then perhaps it will remind me what I did to get around it?
mapo80 commentedon Sep 18, 2020
Guys thanks for your help, I need to disable Ivy but if I disable something goes wrong.
To solve this issue it’s needed to make a new version of @nativescript/angular with nativescript disabled. There is a PR to disable Ivy: #2254
To test this bug with Ivy disabled just try to build this simple project:
https://github.com/mapo80/TestNs7Ng10
armourjami commentedon Sep 18, 2020
Ok no problem. However, I did manage to get around that exact issue with Ivy enabled, so it is possible.
tuxtux59 commentedon Oct 16, 2020
Hi,
Does anyone found the right fix instead of enabling Ivy ?
I'm facing also this issue and enabling Ivy is making my app running but wondering the accuracy of this procedure.
In my case the error is thrown by one of my generated lib but there is a lack of debugging to find which code block is origin of this error