Github actions eslint: command not found

I recently created this action and want to lint the typescripts files using the eslint, but I get the error saying that eslint: command not found.

I am not sure what is wrong here, I need help to fix this issue.

This is my workflow file

name: CI

on:
  push:
    branches: [ main ]
  pull_request:
    branches: [ main ]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: Install modules
      run: yarn
    - name: Run ESLint
      run: eslint . --ext .ts,.tsx

I’m having the same issue. Could you figure that one out by now?

I had the same issue, adding yarn run before eslint fixed it for me.

In case of your file, you’d have to change the last line to:

      run: yarn run eslint . --ext .ts,.tsx

If you’re using npm then you should replace yarn run with npx.

1 Like

Thanks for the solution it worked :slight_smile:

Alternatively you can run using ./node_modules/.bin/eslint