programing

WebStorm 2018.1.4 + ESLint: TypeError: 이것.CliEngine은 생성자가 아닙니다.

kingscode 2023. 3. 22. 22:37
반응형

WebStorm 2018.1.4 + ESLint: TypeError: 이것.CliEngine은 생성자가 아닙니다.

제 구성은 이렇습니다.

WebStorm 2018.1.4, ESLint 6.4, 노드 12.8, npm 6.10.2, Windows 8.1.

스레드 제목의 오류를 제거하려면 어떻게 해야 합니까?

여기 코드 샘플이 있습니다.

import {
  GET_DAILY_SUCCESS,
  GET_HOURLY_SUCCESS,
  GET_MINUTE_SUCCESS
} from './types';
import {
  getDailyToUsd,
  getHourlyToUsd,
  getMinuteToUsd
} from '../api/cryptocompare';
import { setError } from './error';

export const getDaily = (fsym = 'BTC') => async dispatch => {
  try {
    const list = await getDailyToUsd(fsym);

    dispatch({
      type: GET_DAILY_SUCCESS,
      currency: fsym,
      list
    });
  } catch(err) {
    dispatch(setError(err.Message));
  }
};

WEB-38922는 2019.1.3에서 수정되었습니다.이 문제는 ESLint 버전 6.x에서 발생합니다.Webstorm 업그레이드를 선택할 수 없는 경우 ESLint 버전5로 다운그레이드해야 합니다.

npm install --save-dev eslint@5

업데이트: ESLint 8 사용 시 동일한 오류가 발생할 경우 지원되는 버전 2021.2.2로 업그레이드하십시오(WEB-52236 참조).

My Webstorm 2021.2에서 약간 다른 오류가 발생하였습니다.this.CliEngineCtor is not a constructor.

그것은 eslint를 8.0.1로 업데이트 하는 것과 관련이 있습니다.

해결책: WebStorm을 최신 버전 2021.2.2 이상으로 업데이트

다음은 Dmitry Babenko의 다른 솔루션으로, WebStorm의 폴백 라이선스와 함께 ESLint 6.x를 사용할 수 있도록 합니다.

  • 대기:this.CliEngine is not a constructor풍선이 표시되도록 하고 "상세"를 클릭합니다.
  • 스택 트레이스 내의 첫 번째 링크에 따라eslint-plugin.js파일
  • 맨 위에서 다음 행을 찾습니다.
    this.CliEngine = require(this.basicPath + "lib/cli-engine");
    그리고 다음 것으로 교체합니다.
    this.CliEngine = require(this.basicPath).CLIEngine;
  • IDEA의 재기동

Dabrule 답변 외에 다음과 같은 답변이 있습니다.

eslint v8의 경우 다음 행을 바꿉니다.

this.cliEngineCtor = requireInContext(eslintPackagePath + "lib/api", state.packageJsonPath).CLIEngine;

다음과 같이 입력합니다.

this.cliEngineCtor = requireInContext(eslintPackagePath + "lib/cli-engine").CLIEngine;

파일 위치(예: RubyMine) (WebStorm은 비슷해야 합니다):
RubyMine-2021.1.3/plugins/JavaScriptLanguage/languageService/eslint/bin/eslint-plugin.js

Webstorm2021.2.1을 사용하고 있는데 eslint@8.0.0이 호환되지 않는다는 것을 알게 되었습니다.이 방법은 효과가 있었습니다.

yarn add -D eslint@7.14.0

새로운 버전으로 업그레이드하면 이 오류가 해결됩니다.

보시는 바와 같이 2019.1.3에 문제가 해결되었습니다.

WEB-38922 - 2019.1에서 ESLint v6를 사용한 린트가 실패하고 'TypeError: this.cliEngine is not constructor' (유형 오류:

Dabrule과 Johny Martin의 답변 외에 다음과 같은 답변이 있습니다.

eslint 8+의 경우 를 추가합니다.이 행에 CLIEngine:

this.CliEngine = require(this.basicPath + "lib/cli-engine").CLIEngine

IDE 재시작(Webstorm 2018.1.2)

언급URL : https://stackoverflow.com/questions/57944468/webstorm-2018-1-4-eslint-typeerror-this-cliengine-is-not-a-constructor

반응형