tslint-plugin-graphql icon indicating copy to clipboard operation
tslint-plugin-graphql copied to clipboard

tslint CLI - Error: Cannot find module 'tslint'

Open vjsingh opened this issue 6 years ago • 0 comments

Bug Report

  • TSLint version: 5.10.0
  • TypeScript version: 2.8.3
  • Running TSLint via: (pick one) CLI

with tslint.json configuration:

{
  "extends": [
    "tslint:latest", 
    "tslint-react",
    "tslint-plugin-graphql"
  ],
  "rules": {
    "graphql": [
        true,
        {
            "env": "apollo",
            "schemaJsonFilepath": "./server/src/generated/generatedAppSchema.json",
            "tagName": "gql"
        }
    ]
  }
}


Actual behavior

I have tslint successfully set up in my Node+React project.

When I try to run tslint from the command line, I get the following error:

tslint -c tslint.json 'server/src/utils.ts' { Error: Cannot find module 'tslint' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:594:15) at Function.Module._load (internal/modules/cjs/loader.js:520:25) at Module.require (internal/modules/cjs/loader.js:650:17) at require (internal/modules/cjs/helpers.js:20:18) at Object. (/Users/Varun/Documents/workspace/clyme/node_modules/tslint-plugin-graphql/rules/graphqlRule.js:16:16) at Module._compile (internal/modules/cjs/loader.js:702:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:713:10) at Module.load (internal/modules/cjs/loader.js:612:32) at tryModuleLoad (internal/modules/cjs/loader.js:551:12) at Function.Module._load (internal/modules/cjs/loader.js:543:3) code: 'MODULE_NOT_FOUND' }

If I remove the "GraphQL" rule from tslint.json, the tslint command runs

Expected behavior

tslint should run

vjsingh avatar Jun 11 '18 15:06 vjsingh