<!--
Output from: `ng --version`.
If nothing, output from: `node --version` and `npm --version`.
Windows (7/8/10). Linux (incl. distribution). macOS (El Capitan? Sierra?)
-->
Angular CLI: 1.6.8 (e)
Node: 8.9.1
OS: darwin x64
Angular: 5.2.4
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
@angular/cdk: 5.2.0
@angular/cli: 1.6.8
@angular/material: 5.2.0
@angular-devkit/build-optimizer: 0.0.42
@angular-devkit/core: 0.0.29
@angular-devkit/schematics: 0.0.52
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.8
@schematics/angular: 0.1.17
typescript-extends: 1.0.1
typescript: 2.4.2
webpack-concat-plugin: 1.4.0
webpack-dev-server: 2.11.1
webpack: 3.10.0
<!-- Normally this includes a stack trace and some more information. -->
ERROR in Error during template compile of 'PlatformRef'
Function calls are not supported in decorators but 'ɵmakeDecorator' was called in 'Injectable'
'Injectable' calls 'ɵmakeDecorator'.
Same error... was working yesterday.....
Anyone know how to fix this? Or is there a different version I can roll back to?
Please provide the steps you followed to get to this error, or better yet provide a repository that shows this error.
I am getting the same thing, on my own very simple module which provides a simple config value.
ERROR in Error during template compile of 'MyCoPlatformModule'
Function calls are not supported in decorators but 'MyCoComponentsModule' was called.
FIXED.
For me, I was importing a file out of my project config... changing that fixed the error... Finally..
This is my tsconfig - is that what you mean @accilies ?
{
"version": "2.5.3",
"compilerOptions": {
"module": "commonjs",
"target": "ES5",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"baseUrl": "./",
"paths": {
"@angular/*": [
"node_modules/@angular/*"
],
"@uirouter/*": [
"node_modules/@uirouter/*"
]
},
"lib": [
"es2017",
"dom"
]
},
"include": [
"src/**/*.ts"
],
"exclude": [
"test.ts",
"**/*.spec.ts"
]
}
I am hitting the same issue. Simple recreation steps:
ng build --prodThis can be tested simply with this shell script:
mkdir prod-build-error
cd prod-build-error
ng new project1
ng new project2
cd project1/src/app
sed 's|./app.component|../../../project2/src/app/app.component|' <app.module.ts >app.module2.ts
rm app.module.ts
mv app.module2.ts app.module.ts
cd ../..
ng build --prod
Result:
ERROR in ../../project2/src/app/app.component.ts(3,2): Error during template compile of 'AppComponent'
Function calls are not supported in decorators but 'ɵmakeDecorator' was called in 'Component'
'Component' calls 'ɵmakeDecorator'.
+1 on what @pcroc shows.
Getting same error here, when I tried to run cmd: ng build --prod.
will not get this if I don't build in production mode.
Log stack as follow:
Date: 2018-04-11T20:00:47.740Z
Hash: e2a911aa7287d5340be6
Time: 10887ms
chunk {scripts} scripts.***.bundle.js (scripts) 342 kB [initial] [rendered]
chunk {0} styles.***.bundle.css (styles) 716 kB [initial] [rendered]
chunk {1} polyfills.***.bundle.js (polyfills) 84 bytes [initial] [rendered]
chunk {2} main.***.bundle.js (main) 84 bytes [initial] [rendered]
chunk {3} inline.***.bundle.js (inline) 796 bytes [entry] [rendered]
ERROR in Error during template compile of 'PlatformRef'
Function calls are not supported in decorators but 'ɵmakeDecorator' was called in 'Injectable'
'Injectable' calls 'ɵmakeDecorator'.
I managed to figure out what was causing this error in my case. (Seems like this could be caused by many things.)
I have an application that uses a library, where I develop both of them, and the library is symlinked to the application. The library would import { ... } from '@angular/core', but was trying to pull @angular/core from the node_modules local to that _library_ instead of the node_modules local to the _application_.
Adding the Angular modules to the paths in tsconfig.app.json solved the issue. It'll point all of the Angular imports to the node_modules in the _application_ instead of the node_modules in the _library_.
"compilerOptions": {
"paths": {
"@angular/*": [ "../node_modules/@angular/*"]
}
}
@accilies What do you mean by "exporting a file out my project configuration"?
@mderoche But I thought some recent version of TS explicitly solved that problem of "same-but-different" libraries. By the way, did you experiment with --preserve-symlinks?
This error is occurring to me with ^6.0.0 versions.
ERROR in ../@nims/ngutils/lib/collapsible-fieldset/collapsible-fieldset.component.ts(13,2): Error during template compile of 'CollapsibleFieldsetComponent'
Function calls are not supported in decorators but 'ɵmakeDecorator' was called in 'Component'
'Component' calls 'ɵmakeDecorator'.
@mderoche that didnt work for me
i'm trying to create angular-elements element for one component of a bigger app in a different dir.
`import {NgModule,Injector} from '@angular/core';
import {createCustomElement} from '@angular/elements';
import {BrowserModule} from '@angular/platform-browser';
import {SideMenuComponent} from '../../webapp-src/components/app/side-menu.component';
@NgModule({
imports: [BrowserModule],
declarations: [SideMenuComponent],
entryComponents: [SideMenuComponent]
})
export class AppModule {
constructor (private injector: Injector) {
const customElement = createCustomElement(SideMenuComponent, {injector});
customElements.define('side-menu', customElement);
}
ngDoBootstrap () { }
}`
ERROR in ../../webapp-src/components/app/side-menu.component.ts(16,2): Error during template compile of 'SideMenuComponent'
Function calls are not supported in decorators but 'ɵmakeDecorator' was called in 'Component'
'Component' calls 'ɵmakeDecorator'.
ok it did work, just needed to change it to
"baseUrl": "./",
"paths": {
"@angular/": ["node_modules/@angular/"]
},
This usually happens when using npm link
I resolve this problem by change my source code that import component, module with the relative paths to absolute paths.
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._
Most helpful comment
I managed to figure out what was causing this error in my case. (Seems like this could be caused by many things.)
I have an application that uses a library, where I develop both of them, and the library is symlinked to the application. The library would
import { ... } from '@angular/core', but was trying to pull@angular/corefrom thenode_moduleslocal to that _library_ instead of thenode_moduleslocal to the _application_.Adding the Angular modules to the
pathsintsconfig.app.jsonsolved the issue. It'll point all of the Angular imports to thenode_modulesin the _application_ instead of thenode_modulesin the _library_.