question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to load parser '@typescript-eslint/parser' declared in 'BaseConfig': Cannot find module 'typescript'

See original GitHub issue

Tell us about your environment

Environment Info:

Node version: v10.16.3
npm version: v6.11.3
Local ESLint version: v6.5.1 (Currently used)
Global ESLint version: Not found
typescript-eslint/parser

Please show your full configuration:

{
  "author": "Eric MORAND <eric.morand@gmail.com>",
  "name": "twing",
  "description": "First-class Twig engine for Node.js",
  "keywords": [
    "browser",
    "compiler",
    "template",
    "twig",
    "twig-engine",
    "typescript"
  ],
  "version": "3.0.1",
  "homepage": "http://NightlyCommit.github.io/twing",
  "license": "BSD-2-Clause",
  "repository": {
    "type": "git",
    "url": "git://github.com/NightlyCommit/twing"
  },
  "main": "dist/cjs/main.js",
  "browser": "dist/es/browser.js",
  "module": "dist/es",
  "types": "dist/types/main.d.ts",
  "engines": {
    "node": ">=6.0.0"
  },
  "scripts": {
    "precover": "rimraf coverage .nyc_output",
    "postbuild:cjs": "replace-in-file '__VERSION__' $npm_package_version dist/cjs/**/*",
    "postbuild:es": "replace-in-file '__VERSION__' $npm_package_version dist/es/**/*",
    "pretest": "rimraf test/tests/types/dist && npm run build:cjs -- --sourceMap true",
    "pretest:browser": "npm run pretest",
    "pretest:types": "npm run pretest && rimraf test/tests/types/dist",
    "prepack": "npm run build && npm run bundle",
    "test": "npm run fastest:all",
    "test:browser": "npm run fastest:integration:browser",
    "test:docs": "cd docs && bundle exec jekyll build",
    "test:types": "tsc --project test/tests/types",
    "fastest:all": "tape 'test/tests/**/test.js' | tap-bail | tap-spec",
    "fastest:integration": "tape test/tests/integration/**/test.js | tap-bail | tap-spec",
    "fastest:integration:browser": "node test/tests/integration/browser.js | browserify - --basedir ./test -t [ stringify --extensions [.html .twig] ] | tape-run --render='tap-spec'",
    "fastest:unit": "tape 'test/tests/unit/**/test.js' | tap-bail | tap-spec",
    "cover": "nyc npm t",
    "coverage": "nyc report --reporter=text-lcov | coveralls",
    "build": "npm run build:cjs && npm run build:es && npm run build:types",
    "build:cjs": "rimraf dist/cjs && tsc --project . --module commonjs --outDir dist/cjs",
    "build:es": "rimraf dist/es && tsc --project . --module es6 --outDir dist/es",
    "build:types": "rimraf dist/types && tsc --project . --declaration true --emitDeclarationOnly true --outDir dist/types",
    "bundle": "browserify dist/cjs/browser.js -g uglifyify -s Twing -o dist/lib.min.js",
    "docs": "cd docs && bundle exec jekyll serve",
    "docs:install": "cd docs && bundle install --path vendor/bundle"
  },
  "dependencies": {
    "@types/luxon": "^1.4.0",
    "camelcase": "^4.1.0",
    "capitalize": "^1.0.0",
    "crypto-js": "^3.1.9-1",
    "esrever": "^0.2.0",
    "fs-extra": "^5.0.0",
    "htmlspecialchars": "^1.0.5",
    "iconv-lite": "^0.4.19",
    "is-integer": "^1.0.7",
    "is-number": "^5.0.0",
    "is-plain-object": "^2.0.4",
    "isobject": "^3.0.1",
    "levenshtein": "^1.0.5",
    "locutus": "^2.0.11",
    "luxon": "^1.19.3",
    "merge": "^1.2.1",
    "object-hash": "^1.2.0",
    "pad": "^2.0.3",
    "regex-parser": "^2.2.8",
    "runes": "^0.4.3",
    "snake-case": "^2.1.0",
    "source-map": "^0.6.1",
    "tmp": "0.0.33",
    "twig-lexer": "^0.6.3",
    "utf8-binary-cutter": "^0.9.2",
    "var-validator": "0.0.3"
  },
  "devDependencies": {
    "@types/locutus": "0.0.5",
    "@types/node": "^9.3.0",
    "@types/sinon": "^4.3.0",
    "@types/tmp": "0.0.33",
    "@typescript-eslint/parser": "^2.3.2",
    "browserify": "^16.2.3",
    "coveralls": "^3.0.0",
    "eslint": "^6.5.1",
    "fs-finder": "^1.8.1",
    "node-hook": "^1.0.0",
    "nyc": "^13.3.0",
    "replace-in-file": "^3.4.2",
    "rimraf": "^2.6.2",
    "sinon": "^6.3.4",
    "stringify": "^5.2.0",
    "tap-bail": "^1.0.0",
    "tap-spec": "^5.0.0",
    "tape": "^4.9.0",
    "tape-run": "^6.0.0",
    "typescript": "^3.1.3",
    "uglifyify": "^5.0.1"
  }
}

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.

sudo npm install eslint --save-dev
sudo npm install @typescript-eslint/parser --save-dev
sudo ./node_modules/.bin/eslint --init
? How would you like to use ESLint? To check syntax, find problems, and enforce code style
? What type of modules does your project use? CommonJS (require/exports)
? Which framework does your project use? None of these
? Does your project use TypeScript? Yes
? Where does your code run? (Press <space> to select, <a> to toggle all, <i> to invert selection)Browser, Node
? How would you like to define a style for your project? Inspect your JavaScript file(s)
? Which file(s), path(s), or glob(s) should be examined? /home/noel/Documents/sync/twing/twing/src/**/*.ts
? What format do you want your config file to be in? JSON

What did you expect to happen? Initializing ESLINT and after that checking the code.

What actually happened? Please include the actual, raw output from ESLint.

? What format do you want your config file to be in? JSON
Determining Config: 0% [------------------------------] 0.0s elapsed, eta 0.0s 

Failed to load parser '@typescript-eslint/parser' declared in 'BaseConfig': Cannot find module 'typescript'
Error: Failed to load parser '@typescript-eslint/parser' declared in 'BaseConfig': Cannot find module 'typescript'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (/home/noel/Documents/sync/twing/twing/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (/home/noel/Documents/sync/twing/twing/node_modules/@typescript-eslint/typescript-estree/dist/parser.js:18:25)
    at Module._compile (/home/noel/Documents/sync/twing/twing/node_modules/v8-compile-cache/v8-compile-cache.js:194:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
noeleliascommented, Oct 4, 2019

Ah okay I manually added typescript … seems like that solved the problem Thank you so much!

1reaction
kaicataldocommented, Oct 5, 2019

Glad you were able to solve it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

eslint/eslint - Gitter
Failed to load parser '@typescript-eslint/parser' declared in 'BaseConfig': Cannot find module 'typescript' Error: Failed to load parser ...
Read more >
Failed to load parser '@typescript-eslint/parser declared in ...
Failed to load parser '@typescript-eslint/parser declared in 'BaseConfig ... cannot find module '@typescript-eslint/parser'.
Read more >
Error with my ".eslintrc.js" file - "Parsing error: "parserOptions ...
project" config), eslint throws an error if you attempt to lint a file that isn't one of the files that's included in the...
Read more >
Configuration Files - ESLint - Pluggable JavaScript Linter
Note that ESLint does not support ESM configuration at this time. ... file that uses the typescript-eslint parser to support TypeScript syntax:.
Read more >
How to use ESLint with TypeScript | Khalil Stemmler
npm install --save-dev eslint @typescript-eslint/parser ... no-console 5:3 error 'console' is not defined no-undef 5:17 error Missing ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found