简体   繁体   English

找不到用于 CircleCI 构建的 ESLint

[英]ESLint not found for CircleCI build

I'm trying to run a simple build on CircleCI for a Node.js application:我正在尝试在 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

package.json包.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 ?为什么 CircleCI 看不到ESLintnode_modules

The yarn lint command works fine locally. yarn lint命令在本地运行良好。

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    

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM