Skip to content

npm start lint, cannot parse the template #2812

Closed

Description

@morriq

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)

Activity

  1. binarious commented on Oct 21, 2016

    @binarious

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

  2. morriq commented on Oct 21, 2016

    @morriq
    Author

    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

  3. turolla commented on Oct 21, 2016

    @turolla

    Same problem also for me. Thanks @binarious !

  4. drinkbird commented on Oct 22, 2016

    @drinkbird

    Same problem, thanks for the suggestion @binarious

  5. Splaktar commented on Oct 23, 2016

    @Splaktar
    Contributor

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

  6. Splaktar commented on Oct 23, 2016

    @Splaktar
    Contributor

    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.

  7. nicolae536 commented on Oct 24, 2016

    @nicolae536

    Do you know when the bugfix will be released ?

  8. ajmebc commented on Oct 24, 2016

    @ajmebc

    Same here

  9. Splaktar commented on Oct 25, 2016

    @Splaktar
    Contributor

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

  10. added a commit that references this issue on Oct 28, 2016
    ba14332
  11. JohannesRudolph commented on Oct 29, 2016

    @JohannesRudolph
    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 ?

  12. filipesilva commented on Nov 3, 2016

    @filipesilva
    Contributor

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

  13. timvl commented on Nov 24, 2016

    @timvl

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

  14. added a commit that references this issue on Dec 14, 2016
  15. added a commit that references this issue on Feb 9, 2017
    902691b
  16. angular-automatic-lock-bot commented on Sep 6, 2019

    @angular-automatic-lock-bot

    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.

  17. locked and limited conversation to collaborators on Sep 6, 2019
  18. added a commit that references this issue on May 29, 2026
    f02484e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions