[eslint] Failed to load parser ‘@typescript-eslint/parser‘ declared in ‘package.json » eslint-confi

Failed to compile.

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

  • /Users/zhangmin/Desktop/练习/react-ahooks/node_modules/@typescript-eslint/typescript-estree/dist/parser.js
  • /Users/zhangmin/Desktop/练习/react-ahooks/node_modules/@typescript-eslint/typescript-estree/dist/index.js
  • /Users/zhangmin/Desktop/练习/react-ahooks/node_modules/@typescript-eslint/parser/dist/parser.js
  • /Users/zhangmin/Desktop/练习/react-ahooks/node_modules/@typescript-eslint/parser/dist/index.js
  • /Users/zhangmin/Desktop/练习/react-ahooks/node_modules/@eslint/eslintrc/dist/eslintrc.cjs
    ERROR in [eslint] Failed to load parser ‘@typescript-eslint/parser’ declared in ‘package.json » eslint-config-react-app#overrides[0]’: Cannot find module ‘typescript’
    Require stack:
  • /Users/zhangmin/Desktop/练习/react-ahooks/node_modules/@typescript-eslint/typescript-estree/dist/parser.js
  • /Users/zhangmin/Desktop/练习/react-ahooks/node_modules/@typescript-eslint/typescript-estree/dist/index.js
  • /Users/zhangmin/Desktop/练习/react-ahooks/node_modules/@typescript-eslint/parser/dist/parser.js
  • /Users/zhangmin/Desktop/练习/react-ahooks/node_modules/@typescript-eslint/parser/dist/index.js
  • /Users/zhangmin/Desktop/练习/react-ahooks/node_modules/@eslint/eslintrc/dist/eslintrc.cjs

在这里插入图片描述

解决方法:


npm i --save-dev typescript @typescript-eslint/parser

猜你喜欢

转载自blog.csdn.net/zm_miner/article/details/125601222