Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function calls are not supported in decorators but '傻makeDecorator' was called in 'Injectable' #32694

Closed
ovione opened this issue Sep 16, 2019 · 18 comments
Labels
area: compiler Issues related to `ngc`, Angular's template compiler freq1: low hotlist: error messages P5 The team acknowledges the request but does not plan to address it, it remains open for discussion type: confusing
Milestone

Comments

@ovione
Copy link

ovione commented Sep 16, 2019

馃悶 bug report

Is this a regression?

Yes, the previous version in which this bug was not present was: 6
I upraded my project to version 8

Description

I build for production and I got the error.

Globally I have @angular/cli@7.3.5 but locally I have angular/cli": "8.3.3",
I guess the local angular cli is used.
My project uses libraries that I build with angular 6.1.0

馃敩 Minimal Reproduction

ng build --prod

馃敟 Exception or Error


ERROR in Error during template compile of 'PlatformRef'
  Function calls are not supported in decorators but '傻makeDecorator' was called in 'Injectable'
    'Injectable' calls '傻makeDecorator'.

馃實 Your Environment

Angular Version:


Angular CLI: 8.3.4
Node: 10.14.2
OS: win32 x64
Angular: 8.2.6
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.803.4
@angular-devkit/build-angular     0.803.4
@angular-devkit/build-optimizer   0.803.4
@angular-devkit/build-webpack     0.803.4
@angular-devkit/core              8.3.4
@angular-devkit/schematics        8.3.4
@angular/cli                      8.3.4
@ngtools/webpack                  8.3.4
@schematics/angular               8.3.4
@schematics/update                0.803.4
rxjs                              6.5.3
typescript                        3.5.3
webpack                           4.39.2

Anything else relevant?
this is my package.json


 "dependencies": {
   "dependencies": {
    "@angular/animations": "8.2.6",
    "@angular/common": "8.2.6",
    "@angular/compiler": "8.2.6",
    "@angular/core": "8.2.6",
    "@angular/forms": "8.2.6",
    "@angular/platform-browser": "8.2.6",
    "@angular/platform-browser-dynamic": "8.2.6",
    "@angular/router": "8.2.6",
    "@ngx-translate/core": "10.0.2",
    "@ngx-translate/http-loader": "3.0.1",
    "bootstrap": "^4.3.1",
    "core-js": "2.5.7",
    "font-awesome": "4.7.0",
    "jquery": "3.3.1",
    "json-server": "0.14.2",
    "moment": "2.22.2",
    "moment-timezone": "0.5.21",
    "ngx-bootstrap": "3.0.1",
    "ngx-cookie": "4.0.2",
    "ngx-webstorage": "2.0.1",
    "rxjs": "6.5.3",
    "tslib": "^1.10.0",
    "web-animations-js": "^2.3.2",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.803.4",
    "@angular/cli": "~8.3.4",
    "@angular/compiler-cli": "^8.2.6",
    "@angular/language-service": "^8.2.6",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/moment-timezone": "0.5.9",
    "@types/node": "~8.9.4",
    "codelyzer": "^5.0.1",
    "jasmine-core": "~2.99.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~3.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~3.5.3"
  }
@AndrewKushnir AndrewKushnir added the area: compiler Issues related to `ngc`, Angular's template compiler label Sep 16, 2019
@ngbot ngbot bot added this to the needsTriage milestone Sep 16, 2019
@ovione
Copy link
Author

ovione commented Sep 17, 2019

For my project I found the solution:

In my project in angular 6 I had:


import { ParamMap } from "@angular/router/src/shared";

this.route.queryParamMap.subscribe((paramMap: ParamMap) => {

When I migrated to angular 8 I had the error:


ERROR in Error during template compile of 'PlatformRef'
  Function calls are not supported in decorators but '傻makeDecorator' was called in 'Injectable'
    'Injectable' calls '傻makeDecorator'.

To get rid of this error I had to write the prior code like:
PS: note that I deleted the ParamMap everywhere.


this.route.queryParamMap.subscribe((paramMap) => {

@alxhub
Copy link
Member

alxhub commented Oct 8, 2019

Hello @ovione,

Unfortunately we won't be able to investigate this issue without a minimal reproduction, including the code (preferably a link to a Github repo) which causes the issue.

Thanks,
Alex

@nmanthena18
Copy link

I am also facing same issue. anybody got the solutions for it?.

@zwietabak
Copy link

Same here like @nmanthena18 after upgrading from angular 7 to 8...

@lan-dry
Copy link

lan-dry commented Dec 9, 2019

Hi please I ma getting the same issue after migrating from angular 6 to 8:
Error during template compile of 'Injectable'
Function calls are not supported in decorators but '傻makeDecorator' was called.
...

May someone help me please?

@vagnersabadi
Copy link

Angular 7 for 8

> ng.cmd run app:build:production

ERROR in Error during template compile of 'NgModule'
  Function calls are not supported in decorators but '傻makeDecorator' was called.
Error during template compile of 'Directive'
  Function calls are not supported in decorators but '傻makeDecorator' was called.
Error during template compile of 'Directive'
  Function calls are not supported in decorators but '傻makeDecorator' was called.
Error during template compile of 'Injectable'
  Function calls are not supported in decorators but '傻makeDecorator' was called.
Error during template compile of 'Injectable'
  Function calls are not supported in decorators but '傻makeDecorator' was called.
Error during template compile of 'Injectable'
Error during template compile of 'Injectable'
  Function calls are not supported in decorators but '傻makeDecorator' was called.
Error during template compile of 'Injectable'
  Function calls are not supported in decorators but '傻makeDecorator' was called.
Error during template compile of 'Injectable'
  Function calls are not supported in decorators but '傻makeDecorator' was called.
Error during template compile of 'Injectable'
  Function calls are not supported in decorators but '傻makeDecorator' was called.
Error during template compile of 'NgModule'
  Function calls are not supported in decorators but '傻makeDecorator' was called.
Error during template compile of 'Injectable'
  Function calls are not supported in decorators but '傻makeDecorator' was called.

[ERROR] An error occurred while running subprocess ng.

        ng.cmd run app:build:production exited with exit code 1.

@AntonyJos
Copy link

Angular issue

receiving the above set of errors on upgrading the project from Angular 5 to Angular 8 for Prod build

@alxhub / @AndrewKushnir , Any update on this issue?

@Sanketjo
Copy link

Same issue I am facing , Any help will definitely appreciated

@akshaykmr080
Copy link

Any update regarding this issue?

@davidemess
Copy link

"compilerOptions": {
    "paths": {
        "@angular/*": [ "node_modules/@angular/*"]
    }
  }

Adding this to tsconfig.json worked for me

Look at #9576 issue too

@alirezabahary
Copy link

"compilerOptions": {
    "paths": {
        "@angular/*": [ "node_modules/@angular/*"]
    }
  }

Adding this to tsconfig.json worked for me

Look at #9576 issue too

this worked for me

@cefamax
Copy link

cefamax commented Feb 5, 2020

this worked for me too; but why?

@jasmeetappinventiv
Copy link

Angular issue

receiving the above set of errors on upgrading the project from Angular 5 to Angular 8 for Prod build

@alxhub / @AndrewKushnir , Any update on this issue?

did you found any solution?

@ChaitanyaBabar
Copy link

"compilerOptions": {
    "paths": {
        "@angular/*": [ "node_modules/@angular/*"]
    }
  }

Adding this to tsconfig.json worked for me

Look at #9576 issue too

To : @davidemess
CC :@Hank1370 , @cefamax

This worked for me too.

I am still wondering how/why it worked ?
@davidemess Can you please elaborate why/how it worked ?

Thanks,
Chaitanya

@segux
Copy link

segux commented May 7, 2020

I think it works because compiler are resolving every angular dependency with node_modules root folder dependency.
Probably you have some dependencies with different angular versions

@alxhub
Copy link
Member

alxhub commented May 27, 2020

Yeah, I've seen this happen when there are multiple versions of Angular in node_modules. npm ls is your friend.

@ngbot ngbot bot modified the milestones: Backlog, needsTriage May 27, 2020
@ngbot ngbot bot modified the milestones: needsTriage, Backlog Sep 22, 2020
@jelbourn jelbourn added P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent and removed P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent labels Oct 1, 2020
@ngbot ngbot bot modified the milestones: Backlog, needsTriage Oct 1, 2020
@jelbourn jelbourn added the P5 The team acknowledges the request but does not plan to address it, it remains open for discussion label Oct 1, 2020
@ngbot ngbot bot modified the milestones: needsTriage, Backlog Oct 1, 2020
@JoostK
Copy link
Member

JoostK commented May 14, 2021

This is no longer an issue with Ivy, so closing as resolved.

@JoostK JoostK closed this as completed May 14, 2021
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jun 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: compiler Issues related to `ngc`, Angular's template compiler freq1: low hotlist: error messages P5 The team acknowledges the request but does not plan to address it, it remains open for discussion type: confusing
Projects
None yet
Development

No branches or pull requests