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.

eslint-config-react-app > @typescript-eslint/parser missing typescript?

See original GitHub issue

Describe the bug

Running: npx eslint . Returns: Failed to load parser '@typescript-eslint/parser' declared in 'package.json » eslint-config-react-app#overrides[0]': Cannot find module 'typescript'

Did you try recovering your dependencies?

Tried reinstalling everything, sadly it didn’t work.

I’ve also tried installing typescript as described in the error but it was lacking a tsconfig.json and I also doubt I should have one if this is not a typescript project.

Environment

Environment Info:

  current version of create-react-app: 3.4.0
  running from /Users/peteyycz/.nvm/versions/node/v10.19.0/lib/node_modules/create-react-app

  System:
    OS: macOS 10.15.4
    CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
  Binaries:
    Node: 10.19.0 - ~/.nvm/versions/node/v10.19.0/bin/node
    Yarn: Not Found
    npm: 6.14.2 - ~/.nvm/versions/node/v10.19.0/bin/npm
  Browsers:
    Chrome: 80.0.3987.149
    Firefox: 74.0
    Safari: 13.1
  npmPackages:
    react: ^16.13.1 => 16.13.1
    react-dom: ^16.13.1 => 16.13.1
    react-scripts: 3.4.1 => 3.4.1
  npmGlobalPackages:
    create-react-app: 3.4.0

Steps to reproduce

(Write your steps here:)

  1. npx create-react-app myapp
  2. cd myapp
  3. npx eslint .

Expected behavior

It should have ran eslint.

Actual behavior

Failed to load parser '@typescript-eslint/parser' declared in 'package.json » eslint-config-react-app#overrides[0]': Cannot find module 'typescript'

Additional resources

Based on my investigation it might be related to how eslint is now resolving configuration:

https://eslint.org/docs/user-guide/migrating-to-6.0.0#package-loading-simplification Which I have found here: https://github.com/standard/semistandard/issues/249

EDIT: although now I think about it it’s probably a different issue: their case the plugin was missing but in my case the plugin is found but the plugin is missing typescript as a peerdep.


https://github.com/facebook/create-react-app/blob/master/packages/eslint-config-react-app/package.json#L19

and this optional: https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/parser/package.json#L56 is not really optional


Might also be related https://github.com/eslint/eslint/issues/12376

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:16
  • Comments:9

github_iconTop GitHub Comments

14reactions
alex-benoitcommented, Apr 30, 2020

you can fix this by adding typescript to your dependencies

npm install typescript --save-dev

1reaction
tnovaucommented, Jun 7, 2020

yarn add -D typescript

Read more comments on GitHub >

github_iconTop Results From Across the Web

create react app - without typescript , got Error: Failed to load ...
Error: Failed to load parser '@typescript-eslint/parser' declared in 'package.json » eslint-config-react-app#overrides[0]': Cannot find ...
Read more >
eslint-config-react-app-ts - npm package - Snyk
This package extends eslint-config-react-app for TypeScript files by parsing them with typescript-eslint-parser and preventing conflicts ...
Read more >
Node v16.15.1 (npm v8.11.0) breaks some builds
... resolving: eslint-config-react-app@6.0.0 7:57:50 PM: Creating deploy upload records 7:57:49 PM: npm WARN Found: @typescript-eslint/parser@5.23.0 7:57:49 ...
Read more >
@typescript-eslint/eslint-plugin - npm
TypeScript plugin for ESLint. Latest version: 5.47.1, last published: 2 days ago. Start using @typescript-eslint/eslint-plugin in your ...
Read more >
eslint-config-react-app | Yarn - Package Manager
eslint-config-react-app. This package includes the shareable ESLint configuration used by Create React App. Please refer to its documentation:.
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