angular-cli: Updated to angular/cli:^1.6.8 - Error during template compile of 'PlatformRef'

Versions

<!--
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

Repro steps

  • Step 1
  • Step 2
  • Step 3

Observed behavior

<!-- 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'.

Desired behavior

Mention any other details that might be useful (optional)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 5
  • Comments: 18 (1 by maintainers)

Most upvoted comments

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/*"]
    }
  }

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’.