CodexBloom - Programming Q&A Platform

GitHub Actions fails to run tests on push when using Node.js with a specific version of ESLint

👀 Views: 11 💬 Answers: 1 📅 Created: 2025-09-06
github-actions eslint node.js JavaScript

I'm following best practices but I'm stuck on something that should probably be simple... I've searched everywhere and can't find a clear answer. I'm trying to set up a GitHub Actions workflow to run my unit tests for a Node.js project, but the workflow fails during the linting step when I push to the repository. The error message I receive is `Error: ESLint couldn't find the plugin 'react'.` I have the following setup: In my `package.json`, I have: ```json { "devDependencies": { "eslint": "^7.32.0", "eslint-plugin-react": "^7.28.0" } } ``` My `.eslintrc.json` looks like this: ```json { "extends": "eslint:recommended", "plugins": ["react"], "rules": { // custom rules here } } ``` In my GitHub Actions workflow file (`.github/workflows/ci.yml`), I specified the Node.js version and installed dependencies as follows: ```yaml name: CI on: push: branches: - main jobs: lint: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Setup Node.js uses: actions/setup-node@v2 with: node-version: '14' - name: Install dependencies run: npm install - name: Run ESLint run: npx eslint . ``` I've tried running the same commands locally, and everything works perfectly. I also confirmed that the plugin is indeed installed in my `node_modules` folder after running `npm install`. Additionally, I’ve set up caching in my workflow to speed up installs, but I suspect it might not be correctly caching the dependencies. Could this be an issue with the caching mechanism, or is there something else I might be missing in my GitHub Actions configuration? Any insights would be greatly appreciated! I'm working on a service that needs to handle this. What am I doing wrong? The stack includes Javascript and several other technologies. Cheers for any assistance! I'm working on a CLI tool that needs to handle this. I'm using Javascript stable in this project. Has anyone else encountered this?