"error TS2304: Cannot find name "ViewEncapsulation'" when I run 'ng generate component '.
See original GitHub issueThis seems to be an infrequent problem for you that keeps popping up. See #4832
Bug Report or Feature Request (mark with an x
)
- [x ] bug report -> please search issues before submitting
- [ ] feature request
Versions.
Windows 7
Angular CLI: 1.5.0 Node: 6.11.3 OS: win32 x64 Angular: 5.0.0 … animations, common, compiler, compiler-cli, core, forms … http, language-service, platform-browser … platform-browser-dynamic, router @angular/cli: 1.5.0 @angular-devkit/build-optimizer: 0.0.32 @angular-devkit/core: 0.0.20 @angular-devkit/schematics: 0.0.35 @ngtools/json-schema: 1.1.0 @ngtools/webpack: 1.8.0 @schematics/angular: 0.1.1 typescript: 2.4.2 webpack: 3.8.1
Repro steps.
I started your Tour of heroes tutorial. Step 3 had me run ng generate component heroes. This caused the compile to fail with error TS2304: Cannot find name ‘ViewEncapsulation’. The tutorial didn’t expect this line at the bottom of the component definition. encapsulation: ViewEncapsulation.None I had to manually add - import { ViewEncapsulation } from ‘@angular/core’; to fix the error.
The log given by the failure.
error TS2304: Cannot find name ‘ViewEncapsulation’
Desired functionality.
Mention any other details that might be useful.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6
I know, it is in the repro steps. I’m just saying that it should generate files that compile.
import { ViewEncapsulation } from ‘@angular/core’ this will fix the problem.