天天看點

Oops! Something went wrong! :( ESLint couldn‘t find the plugin “eslint-plugin-@typescript-eslint“.

報錯資訊

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版本适配的版本。

繼續閱讀