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