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

Already on GitHub? Sign in to your account

npm start lint, cannot parse the template #2812

Closed
morriq opened this issue Oct 21, 2016 · 14 comments
Closed

npm start lint, cannot parse the template #2812

morriq opened this issue Oct 21, 2016 · 14 comments

Comments

@morriq
Copy link

morriq commented Oct 21, 2016

Hello, after upgrade to newest version of angular-cli (from beta 17) and runing command npm start lint I have error:

Cannot parse the template TypeError: Cannot read property 'TemplateParser' of undefined at Object.exports.parseTemplate (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\templateParser.js:7:27) at InputMetadataWalker.Ng2Walker.visitClassDecorator (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\ng2Walker.js:123:70) at Array.forEach (native) at InputMetadataWalker.Ng2Walker.visitClassDeclaration (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\ng2Walker.js:73:40) at InputMetadataWalker.SyntaxWalker.visitNode (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:264:22) at C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:459:63 at visitEachNode (C:\htdocs\GP.Hub\node_modules\typescript\lib\typescript.js:8251:30) at Object.forEachChild (C:\htdocs\GP.Hub\node_modules\typescript\lib\typescript.js:8411:24) at InputMetadataWalker.SyntaxWalker.walkChildren (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:459:12) at InputMetadataWalker.SyntaxWalker.visitSourceFile (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:190:14) Cannot parse the template TypeError: Cannot read property 'TemplateParser' of undefined at Object.exports.parseTemplate (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\templateParser.js:7:27) at OutputMetadataWalker.Ng2Walker.visitClassDecorator (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\ng2Walker.js:123:70) at Array.forEach (native) at OutputMetadataWalker.Ng2Walker.visitClassDeclaration (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\ng2Walker.js:73:40) at OutputMetadataWalker.SyntaxWalker.visitNode (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:264:22) at C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:459:63 at visitEachNode (C:\htdocs\GP.Hub\node_modules\typescript\lib\typescript.js:8251:30) at Object.forEachChild (C:\htdocs\GP.Hub\node_modules\typescript\lib\typescript.js:8411:24) at OutputMetadataWalker.SyntaxWalker.walkChildren (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:459:12) at OutputMetadataWalker.SyntaxWalker.visitSourceFile (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:190:14) Cannot parse the template TypeError: Cannot read property 'TemplateParser' of undefined at Object.exports.parseTemplate (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\templateParser.js:7:27) at ClassMetadataWalker.Ng2Walker.visitClassDecorator (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\ng2Walker.js:123:70) at Array.forEach (native) at ClassMetadataWalker.Ng2Walker.visitClassDeclaration (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\ng2Walker.js:73:40) at ClassMetadataWalker.SyntaxWalker.visitNode (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:264:22) at C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:459:63 at visitEachNode (C:\htdocs\GP.Hub\node_modules\typescript\lib\typescript.js:8251:30) at Object.forEachChild (C:\htdocs\GP.Hub\node_modules\typescript\lib\typescript.js:8411:24) at ClassMetadataWalker.SyntaxWalker.walkChildren (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:459:12) at ClassMetadataWalker.SyntaxWalker.visitSourceFile (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:190:14) Cannot parse the template TypeError: Cannot read property 'TemplateParser' of undefined at Object.exports.parseTemplate (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\templateParser.js:7:27) at ClassMetadataWalker.Ng2Walker.visitClassDecorator (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\ng2Walker.js:123:70) at Array.forEach (native) at ClassMetadataWalker.Ng2Walker.visitClassDeclaration (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\ng2Walker.js:73:40) at ClassMetadataWalker.SyntaxWalker.visitNode (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:264:22) at C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:459:63 at visitEachNode (C:\htdocs\GP.Hub\node_modules\typescript\lib\typescript.js:8251:30) at Object.forEachChild (C:\htdocs\GP.Hub\node_modules\typescript\lib\typescript.js:8411:24) at ClassMetadataWalker.SyntaxWalker.walkChildren (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:459:12) at ClassMetadataWalker.SyntaxWalker.visitSourceFile (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:190:14) Cannot parse the template TypeError: Cannot read property 'TemplateParser' of undefined at Object.exports.parseTemplate (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\templateParser.js:7:27) at Ng2Walker.visitClassDecorator (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\ng2Walker.js:123:70) at Array.forEach (native) at Ng2Walker.visitClassDeclaration (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\ng2Walker.js:73:40) at Ng2Walker.SyntaxWalker.visitNode (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:264:22) at C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:459:63 at visitEachNode (C:\htdocs\GP.Hub\node_modules\typescript\lib\typescript.js:8251:30) at Object.forEachChild (C:\htdocs\GP.Hub\node_modules\typescript\lib\typescript.js:8411:24) at Ng2Walker.SyntaxWalker.walkChildren (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:459:12) at Ng2Walker.SyntaxWalker.visitSourceFile (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:190:14) Cannot parse the template TypeError: Cannot read property 'TemplateParser' of undefined at Object.exports.parseTemplate (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\templateParser.js:7:27) at InputMetadataWalker.Ng2Walker.visitClassDecorator (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\ng2Walker.js:123:70) at Array.forEach (native) at InputMetadataWalker.Ng2Walker.visitClassDeclaration (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\ng2Walker.js:73:40) at InputMetadataWalker.SyntaxWalker.visitNode (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:264:22) at C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:459:63 at visitEachNode (C:\htdocs\GP.Hub\node_modules\typescript\lib\typescript.js:8251:30) at Object.forEachChild (C:\htdocs\GP.Hub\node_modules\typescript\lib\typescript.js:8411:24) at InputMetadataWalker.SyntaxWalker.walkChildren (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:459:12) at InputMetadataWalker.SyntaxWalker.visitSourceFile (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:190:14) Cannot parse the template TypeError: Cannot read property 'TemplateParser' of undefined at Object.exports.parseTemplate (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\templateParser.js:7:27) at OutputMetadataWalker.Ng2Walker.visitClassDecorator (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\ng2Walker.js:123:70) at Array.forEach (native) at OutputMetadataWalker.Ng2Walker.visitClassDeclaration (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\ng2Walker.js:73:40) at OutputMetadataWalker.SyntaxWalker.visitNode (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:264:22) at C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:459:63 at visitEachNode (C:\htdocs\GP.Hub\node_modules\typescript\lib\typescript.js:8251:30) at Object.forEachChild (C:\htdocs\GP.Hub\node_modules\typescript\lib\typescript.js:8411:24) at OutputMetadataWalker.SyntaxWalker.walkChildren (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:459:12) at OutputMetadataWalker.SyntaxWalker.visitSourceFile (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:190:14) Cannot parse the template TypeError: Cannot read property 'TemplateParser' of undefined at Object.exports.parseTemplate (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\templateParser.js:7:27) at ClassMetadataWalker.Ng2Walker.visitClassDecorator (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\ng2Walker.js:123:70) at Array.forEach (native) at ClassMetadataWalker.Ng2Walker.visitClassDeclaration (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\ng2Walker.js:73:40) at ClassMetadataWalker.SyntaxWalker.visitNode (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:264:22) at C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:459:63 at visitEachNode (C:\htdocs\GP.Hub\node_modules\typescript\lib\typescript.js:8251:30) at Object.forEachChild (C:\htdocs\GP.Hub\node_modules\typescript\lib\typescript.js:8411:24) at ClassMetadataWalker.SyntaxWalker.walkChildren (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:459:12) at ClassMetadataWalker.SyntaxWalker.visitSourceFile (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:190:14) Cannot parse the template TypeError: Cannot read property 'TemplateParser' of undefined at Object.exports.parseTemplate (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\templateParser.js:7:27) at ClassMetadataWalker.Ng2Walker.visitClassDecorator (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\ng2Walker.js:123:70) at Array.forEach (native) at ClassMetadataWalker.Ng2Walker.visitClassDeclaration (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\ng2Walker.js:73:40) at ClassMetadataWalker.SyntaxWalker.visitNode (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:264:22) at C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:459:63 at visitEachNode (C:\htdocs\GP.Hub\node_modules\typescript\lib\typescript.js:8251:30) at Object.forEachChild (C:\htdocs\GP.Hub\node_modules\typescript\lib\typescript.js:8411:24) at ClassMetadataWalker.SyntaxWalker.walkChildren (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:459:12) at ClassMetadataWalker.SyntaxWalker.visitSourceFile (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:190:14) Cannot parse the template TypeError: Cannot read property 'TemplateParser' of undefined at Object.exports.parseTemplate (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\templateParser.js:7:27) at Ng2Walker.visitClassDecorator (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\ng2Walker.js:123:70) at Array.forEach (native) at Ng2Walker.visitClassDeclaration (C:\htdocs\GP.Hub\node_modules\codelyzer\angular\ng2Walker.js:73:40) at Ng2Walker.SyntaxWalker.visitNode (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:264:22) at C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:459:63 at visitEachNode (C:\htdocs\GP.Hub\node_modules\typescript\lib\typescript.js:8251:30) at Object.forEachChild (C:\htdocs\GP.Hub\node_modules\typescript\lib\typescript.js:8411:24) at Ng2Walker.SyntaxWalker.walkChildren (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:459:12) at Ng2Walker.SyntaxWalker.visitSourceFile (C:\htdocs\GP.Hub\node_modules\tslint\lib\language\walker\syntaxWalker.js:190:14)

@binarious
Copy link

Same here. Downgrading codelyzer to ~0.0.26 (and removing the new tslint rules) fixes the problem for me.

@ghost
Copy link

ghost commented Oct 21, 2016

Same here. Downgrading codelyzer fixed the issue (thx @binarious :))

@morriq
Copy link
Author

morriq commented Oct 21, 2016

Yea, but downgrading codelyzer is breaking unit tests(at least on my side).

after runing tests it shows

Could not find implementations for the following rules specified in the configuration:
templates-use-public
              invoke-injectable

so if you're downgrading codelyzer then remove

    "templates-use-public": true,
    "invoke-injectable": true

from tslint.json

@turolla
Copy link

turolla commented Oct 21, 2016

Same problem also for me. Thanks @binarious !

@drinkbird
Copy link

Same problem, thanks for the suggestion @binarious

@Splaktar
Copy link
Member

I assume that you mean npm run lint or ng lint and not npm start lint which will try to run ng serve "lint"?

It's working for me with "codelyzer": "1.0.0-beta.2" and "lint": "tslint -c tslint.json 'src/app/**/*.ts' 'src/environments/*.ts' 'src/*.ts'".

@Splaktar
Copy link
Member

Splaktar commented Oct 23, 2016

Oh, it appears to be a problem with Angular 2.1.1. After I upgraded to that from 2.1.0, I started to see this issue.

This issue is fixed in mgechev/codelyzer#124 which hasn't been merged or released yet.

b091 added a commit to icflix-hub/GitHunt-angular2-dead that referenced this issue Oct 23, 2016
@nicolae536
Copy link

Do you know when the bugfix will be released ?

@ajmebc
Copy link

ajmebc commented Oct 24, 2016

Same here

@Splaktar
Copy link
Member

Splaktar commented Oct 25, 2016

@nicolae536 and @ajmebc Fixed in codelyzer 1.0.0-beta.3. I've verified it personally.

@morriq This issue should be resolved once #2812 is merged and angular-cli beta.19 is released. Workaround for now is to use beta.3 of codelyzer.

@morriq morriq closed this as completed Oct 25, 2016
filipesilva pushed a commit that referenced this issue Oct 28, 2016
Fix #2812

Feat - add support for unused CSS in components with enabled `ViewEncapsulation`.

Close #2864
@JohannesRudolph
Copy link
Contributor

I just installed angular-cli beta.19 and re-ran ng init. Turns out it wants version 1.0.0-beta.1 of codelyzer, didn't show it as a diff to upgrade to beta.3

I assume this is not in beta.19-3 of angular-cli @filipesilva ?

@filipesilva
Copy link
Contributor

@JohannesRudolph it's not in beta.19-3, it was merged afterwards.

@timvl
Copy link

timvl commented Nov 24, 2016

Upgrading to codelyzer 1.0.0-beta.3 does the trick for me. I'm using angular-cli 1.0.0-beta.19-3

jessepinho added a commit to jessepinho/redux-talk that referenced this issue Dec 14, 2016
MRHarrison pushed a commit to MRHarrison/angular-cli that referenced this issue Feb 9, 2017
Fix angular#2812

Feat - add support for unused CSS in components with enabled `ViewEncapsulation`.

Close angular#2864
@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 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants