Skip to content

"Error: Cannot find module 'tslint/lib/lint'" when running npm run lint #1189

Closed

Description

@ammarhaider7

Originally submitted as an issue to the codelyzer project but got redirected here. See original issue here - mgechev/codelyzer#159

  • I'm submitting a ...
    [x] bug report
    [ ] feature request
    [ ] question about the decisions made in the repository

  • What is the current behavior?
    Running npm run lint from the latest angular2-webpack-starter repo causes the following error that seems to be originating from importDestructuringSpacingRule.js which wasn't happening a few days ago.

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

  1. Pull latest master
  2. Run npm run lint to produce error
  • What is the expected behavior?
    npm run lint shouldn't error

  • What is the motivation / use case for changing the behavior?
    For projects to be able to continnue using linting features as part of build success criteria.

  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)
    Here's a print out of the console at the point it errors -


> angular2-webpack-starter@5.1.1 lint C:\Users\ammar.haider\oakbrook\angular2-webpack-starter
> npm run tslint "src/**/*.ts"


> angular2-webpack-starter@5.1.1 tslint C:\Users\ammar.haider\oakbrook\angular2-webpack-starter
> tslint "src/**/*.ts"

no-unused-variable is deprecated. Use the tsc compiler options --noUnusedParameters and --noUnusedLocals instead.
module.js:471
    throw err;
    ^

Error: Cannot find module 'tslint/lib/lint'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\Users\ammar.haider\oakbrook\angular2-webpack-starter\node_modules\codelyzer\importDestructuringSpacingRule.js:8:12)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)

Activity

  1. changed the title [-]importDestructuringSpacingRule.js from codelyzer causing "Error: Cannot find module 'tslint/lib/lint'"[/-] [+]"Error: Cannot find module 'tslint/lib/lint'" when running npm run lint[/+] on Nov 21, 2016
  2. avril-verhaeghen commented on Nov 22, 2016

    @avril-verhaeghen

    Having the same issue here

  3. ammarhaider7 commented on Nov 22, 2016

    @ammarhaider7
    Author

    @avril-verhaeghen Just fixed this by locking down tslint to @4.0.0-dev.1

  4. avril-verhaeghen commented on Nov 22, 2016

    @avril-verhaeghen

    Yeah, just found this out too :-), but thanks for sharing :-)

  5. bburttram commented on Nov 22, 2016

    @bburttram

    Thank you, that fix worked for me as well.

  6. self-assigned this
    on Nov 25, 2016
  7. added 2 commits that reference this issue on Nov 25, 2016
  8. added 2 commits that reference this issue on Nov 25, 2016
  9. mgechev commented on Nov 28, 2016

    @mgechev
    Contributor

    Codelyzer@^2.0.0-beta.1 now supports external templates and tslint@^4.0.0.

  10. satishgoud commented on Jan 20, 2017

    @satishgoud

    @ammarhaider7
    I didn't get what you said, can you please clarify.

  11. ammarhaider7 commented on Jan 24, 2017

    @ammarhaider7
    Author

    @satishgoud This shouldn't be an issue anymore as latest Codelyzer supports tslint@4.0.0 but for clarity I meant that fixing the tslint package to a specific version fixed the issue when it existed...
    "tslint": "4.0.0-dev.1",

  12. SatishMHiremath commented on Mar 6, 2018

    @SatishMHiremath

    Codelyzer

    A set of tslint rules for static code analysis of Angular TypeScript projects.

    You can run the static code analyzer over web apps, NativeScript, Ionic, etc.

    Angular CLI has support for codelyzer.Run the below npm command for tslint

    npm i tslint-angular

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions