gpt4 book ai didi

javascript - 找不到用于 CircleCI 构建的 ESLint

转载 作者:行者123 更新时间:2023-12-01 15:27:08 25 4
gpt4 key购买 nike

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

配置.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 看不到 ESLint来自 node_modules ?
yarn lint命令在本地工作正常。

最佳答案

像这样,我可以工作

checklint:
executor: docker-image
steps:
- checkout
- node/install-packages:
cache-path: ~/project/node_modules
override-ci-command: npm install
- run:
command: npm run lint

关于javascript - 找不到用于 CircleCI 构建的 ESLint,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56493317/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com