报错信息
Oops! Something went wrong! :(
ESLint couldn't find the plugin "eslint-plugin-@typescript-eslint". This can happen for a couple different reasons:
1. If ESLint is installed globally, then make sure eslint-plugin-@typescript-eslint is also installed globally. A globally-installed ESLint cannot find a locally-installed plugin.
2. If ESLint is installed locally, then it's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
经stackoverflow查询是eslint版本问题
"@typescript-eslint/eslint-plugin": "^4.10.0",
"@typescript-eslint/parser": "^4.10.0",
"babel-eslint": "^10.1.0",
"prettier": "^2.2.1",
"husky": "^4.0.0",
"lint-staged": "^10.0.0",
"@ecomfe/eslint-config": "^4.0.0",
"eslint": "^7.16.0",
"eslint-config-prettier": "^7.1.0",
"eslint-plugin-prettier": "^3.3.0",
"eslint-plugin-babel": "^5.0.0",
"commitizen": "^4.2.2",
"validate-commit-msg": "^2.14.0"
然后运行有新的报错信息
node_modules/eslint/bin/eslint.js:93
} catch {
^
SyntaxError: Unexpected token {
查了一下,应该是node版本的问题,我本地node8版本不支持这个语法,需要node10以上的,但是我node版本不能升级,这样影响面会比较大。
ESLint v7.0.0 发布:不再支持 Node.js v8
我们使用的eslint是"eslint": “^7.16.0”,
所以需要找eslint和node8版本适配的版本。
然后把eslint降到了 “eslint”: “^6.8.0”,
接着就运行又报错 "prettier"语法错误,然后又修改: “prettier”: "^1.19.1"为这个版本。