Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ESLint not found for CircleCI build

I'm trying to run a simple build on CircleCI for a Node.js application:

config.yml

version: 2.0
jobs:
  build:
    working_directory: ~/app
    docker:
      - image: gcr.io/google-appengine/nodejs
    steps:
      - checkout
      - restore_cache:
          key: dependency-cache-{{ checksum "package.json" }}
      - run:
          name: Install dependencies
          command: yarn
      - save_cache:
          key: dependency-cache-{{ checksum "package.json" }}
          paths:
            - ./node_modules
              - checkout
      - restore_cache:
          key: dependency-cache-{{ checksum "package.json" }}
      - run:
          name: ESLint
          command: yarn lint

package.json

...
"scripts": { 
  "lint": "./node_modules/eslint/bin/eslint.js . --ext .js --fix",
}
...

The error I get is:

#!/bin/bash -eo pipefail
yarn lint
yarn run v1.16.0
$ ./node_modules/eslint/bin/eslint.js . --ext .js --fix
/bin/sh: 1: ./node_modules/eslint/bin/eslint.js: not found
error Command failed with exit code 127.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Exited with code 127

Why can't CircleCI see the ESLint from node_modules?

The yarn lint command works fine locally.

like image 995
Colin Ricardo Avatar asked Jun 07 '19 11:06

Colin Ricardo


1 Answers

like this, I can work

checklint:
        executor: docker-image
        steps:
            - checkout
            - node/install-packages:
                cache-path: ~/project/node_modules
                override-ci-command: npm install
            - run:
                command: npm run lint    
like image 87
Bonnie Avatar answered Oct 14 '22 22:10

Bonnie