找不到CircleCI构建的ESLint

问题描述 投票:5回答:1

我试图在CircleCI上为一个Node.js应用程序运行一个简单的构建。

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

软件包.json

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

我得到的错误是

#!/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

为什么CircleCI看不到 ESLintnode_modules?

yarn lint 命令在本地工作正常。

javascript node.js circleci
1个回答
0
投票

像这样,我就可以工作了

checklint:
        executor: docker-image
        steps:
            - checkout
            - node/install-packages:
                cache-path: ~/project/node_modules
                override-ci-command: npm install
            - run:
                command: npm run lint    
© www.soinside.com 2019 - 2024. All rights reserved.