Search code examples
typescriptsharepointadaptive-cards

Error - [lint] Unexpected STDERR output from ESLint:


I created a Adaptive card extesion but when I want to package my solutions I keep receiving errors.

Error - [lint] Unexpected STDERR output from ESLint: 
Oops! Something went wrong! :(
ESLint: 8.7.0
Error: Failed to load plugin '@typescript-eslint' declared in '.eslintrc.js » @microsoft/eslint-config-spfx/lib/profiles/default': Cannot find module 'eslint/use-at-your-own-risk'
Require stack:
- C:\_dev\IssueTrackerAdaptiveCard\node_modules\@typescript-eslint\eslint-plugin\dist\util\getESLintCoreRule.js
- C:\_dev\IssueTrackerAdaptiveCard\node_modules\@typescript-eslint\eslint-plugin\dist\rules\brace-style.js
- C:\_dev\IssueTrackerAdaptiveCard\node_modules\@typescript-eslint\eslint-plugin\dist\rules\index.js
- C:\_dev\IssueTrackerAdaptiveCard\node_modules\@typescript-eslint\eslint-plugin\dist\index.js
- C:\_dev\IssueTrackerAdaptiveCard\node_modules\@eslint\eslintrc\dist\eslintrc.cjs
Referenced from: C:\_dev\IssueTrackerAdaptiveCard\node_modules\@microsoft\eslint-config-spfx\lib\profiles\default.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
    at Function.Module._load (internal/modules/cjs/loader.js:687:27)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (C:\_dev\IssueTrackerAdaptiveCard\node_modules\v8-compile-cache\v8-compile-cache.js:159:20)
    at C:\_dev\IssueTrackerAdaptiveCard\node_modules\@typescript-eslint\eslint-plugin\dist\util\getESLintCoreRule.js:34:5
    at Object.<anonymous> (C:\_dev\IssueTrackerAdaptiveCard\node_modules\@typescript-eslint\eslint-plugin\dist\rules\brace-style.js:5:60)  
    at Module._compile (C:\_dev\IssueTrackerAdaptiveCard\node_modules\v8-compile-cache\v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)

My Package.json file looks the following

{
  "name": "issue-tracker-adaptive-card",
  "version": "0.0.1",
  "private": true,
  "engines": {
    "node": ">=16.13.0 <17.0.0"
  },
  "main": "lib/index.js",
  "scripts": {
    "build": "gulp bundle",
    "clean": "gulp clean",
    "test": "gulp test"
  },
  "dependencies": {
    "@microsoft/eslint-config-spfx": "^1.17.4",
    "tslib": "2.3.1",
    "@microsoft/sp-core-library": "1.16.0",
    "@microsoft/sp-property-pane": "1.16.0",
    "@microsoft/sp-adaptive-card-extension-base": "1.16.0"
  },
  "devDependencies": {
    "@microsoft/rush-stack-compiler-4.5": "0.2.2",
    "@rushstack/eslint-config": "2.5.1",
    "@microsoft/eslint-plugin-spfx": "1.16.0",
    "@microsoft/eslint-config-spfx": "1.16.0",
    "@microsoft/sp-build-web": "1.16.0",
    "@types/webpack-env": "~1.15.2",
    "ajv": "^6.12.5",
    "gulp": "4.0.2",
    "typescript": "4.5.5",
    "@microsoft/sp-module-interfaces": "1.16.0"
  }
}

I already removed the package-lock.json and node_modules folder and reinstall everything but the same error after running Gulp build.


Solution

  • I found the solution

    Downgrade some of the packages.

    "@typescript-eslint/eslint-plugin": "^5.14.0",
    "@typescript-eslint/parser": "^5.14.0",
    "eslint": "^7.32.0",
    

    Removed the node_module folder again and run npm install.

    Now I'm able to build and package the solution.