Skip to content

viewEncapsulation is not defined #3264

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ritz078 opened this issue Nov 24, 2016 · 13 comments
Closed

viewEncapsulation is not defined #3264

ritz078 opened this issue Nov 24, 2016 · 13 comments
Labels
P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful type: bug/fix

Comments

@ritz078
Copy link
Contributor

ritz078 commented Nov 24, 2016

Please provide us with the following information:

OS?

Mac OSX el capitan

Mac OSX el capitan

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:

angular-cli: 1.0.0-beta.21
node: 6.6.0
os: darwin x64

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.

Ran command ng g component purchase-leads

The log given by the failure.

Normally this include a stack trace and some more information.

viewEncapsulation is not defined (Error in blueprint template: /Users/ritz078/projects/housing-assist/node_modules/angular-cli/blueprints/component/files/__path__/__name__.component.ts)
ReferenceError: viewEncapsulation is not defined (Error in blueprint template: /Users/ritz078/projects/housing-assist/node_modules/angular-cli/blueprints/component/files/__path__/__name__.component.ts)
    at eval (eval at <anonymous> (/Users/ritz078/projects/housing-assist/node_modules/lodash/template.js:225:12), <anonymous>:9:5)
    at processTemplate (/Users/ritz078/projects/housing-assist/node_modules/angular-cli/angular-cli/lib/models/file-info.js:20:36)
    at /Users/ritz078/projects/housing-assist/node_modules/angular-cli/angular-cli/lib/models/file-info.js:97:20
    at tryCatch (/Users/ritz078/projects/housing-assist/node_modules/rsvp/dist/lib/rsvp/-internal.js:215:12)
    at invokeCallback (/Users/ritz078/projects/housing-assist/node_modules/rsvp/dist/lib/rsvp/-internal.js:230:13)
    at publish (/Users/ritz078/projects/housing-assist/node_modules/rsvp/dist/lib/rsvp/-internal.js:198:7)
    at flush (/Users/ritz078/projects/housing-assist/node_modules/rsvp/dist/lib/rsvp/asap.js:85:5)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

Mention any other details that might be useful.


Thanks! We'll be in touch soon.

@toomski
Copy link

toomski commented Nov 24, 2016

I have the same issue with..

angular-cli: 1.0.0-beta.20-4
node: 4.2.6
os: linux x64

Any idea what happend in the last changes? Two weak ago everythinks works fine..

edit: npm link angular-cli in root dir was help me.. now works good

@teledemic
Copy link

I am also getting this when trying to generate a component. It started on beta.20-4 for me.

angular-cli: 1.0.0-beta.21
node: 6.9.1
os: win32 x64

@teledemic
Copy link

I think it may have broken by this feature: #2822

You can kludge around it by adding

		"viewEncapsulation": "Emulated",
		"changeDetection": "Default",

to the "defaults" section of your angular-cli.json. It's supposed to leave out those properties in the new component if the defaults aren't specified, but instead it crashes.

@b4youleap
Copy link

angular-cli: 1.0.0-beta.21
node: 5.12.0
os: win32 x64

I could not get the error in either a new or existing project.

@dallasacook
Copy link

As of my last update of Angular CLI, I am also receiving this error when generating components.

angular-cli: 1.0.0-beta.20-4 node: 4.5.0 os: darwin x64

@finalxcode
Copy link

i have same issue,

ng generate component test1 installing component Error locating module for declaration SilentError: Multiple module files found:

when i try to use '--skip-import', i'm also receive this error.

then i try to use @teledemic advise
"viewEncapsulation": "Emulated", "changeDetection": "Default",
i got:
ng generate component "test1" --skip-import installing component identical src\app\test1\test1.component.css identical src\app\test1\test1.component.html identical src\app\test1\test1.component.spec.ts identical src\app\test1\test1.component.ts Path must be a string. Received undefined

angular-cli: 1.0.0-beta.21
node: 6.4.0
os: win32 x64

@zain3x
Copy link

zain3x commented Dec 12, 2016

angular-cli: 1.0.0-beta.22-1
node: 6.3.1
os: win32 x64

thx @teledemic, your solution work for me.

@filipesilva
Copy link
Contributor

@Brocco can you have a look? It seems #2822 broke this for older project configs.

@filipesilva filipesilva added command: generate P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful type: bug/fix labels Dec 29, 2016
@Meligy
Copy link
Contributor

Meligy commented Jan 9, 2017

This seems to be working fine in master

@masaanli
Copy link

masaanli commented Jan 10, 2017

Also got this error. Tried several things already :)

"viewEncapsulation": "Emulated",
"changeDetection": "Default",

dit the fix

@hansl
Copy link
Contributor

hansl commented Feb 3, 2017

Closing this as fixed.

@hansl hansl closed this as completed Feb 3, 2017
@mzvast
Copy link

mzvast commented May 2, 2017

Change .angular-cli.json like this, working on 1.0.0

  "defaults": {
    "styleExt": "css",
    "component": {
      "viewEncapsulation": "Emulated",
      "changeDetection": "Default"
    }
  }

@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 Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful type: bug/fix
Projects
None yet
Development

No branches or pull requests