GitHub Actions 在运行 Linting 时遇到错误

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

当我尝试运行turbo run lint时,我得到一个 turbo:找不到命令 似乎在上一步中未正确安装开发依赖项。

在此输入图片描述

name: ESLint and Build

on:
  push:
    branches: [master, devo]
  pull_request:
    branches: [master, devo]

jobs:
  lint-and-build:
    timeout-minutes: 15
    runs-on: ubuntu-latest
    steps:
      - name: Check out code
        uses: actions/checkout@v4
        with:
          fetch-depth: 2

      - name: Setup Node.js environment
        uses: actions/setup-node@v4
        with:
          node-version: 20
          cache: "npm"

      - name: Install dependencies
        run: npm install

      - name: Lint
        run: turbo run lint

      - name: Build
        run: npm run build

我与您分享我们正在开发的 yml 以及负责安装依赖项的包,在这些依赖项中,turbo pack 理论上会在运行 Turbo run lint 之前安装它

{
  "name": "mundo-raro",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "workspaces": [
    "apps/*",
    "packages/config/*",
    "packages/shared/*"
  ],
  "scripts": {
    "dev": "turbo dev",
    "storybook": "storybook dev -p 6006",
    "build-storybook": "storybook build",
    "build": "turbo run build",
    "test": "turbo run test"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "@chromatic-com/storybook": "^1.3.3",
    "@playwright/test": "^1.43.1",
    "@storybook/addon-essentials": "^8.0.8",
    "@storybook/addon-interactions": "^8.0.8",
    "@storybook/addon-links": "^8.0.8",
    "@storybook/addon-onboarding": "^8.0.8",
    "@storybook/blocks": "^8.0.8",
    "@storybook/nextjs": "^8.0.8",
    "@storybook/react": "^8.0.8",
    "@storybook/test": "^8.0.8",
    "@types/node": "^20.12.7",
    "storybook": "^8.0.8",
    "turbo": "^1.13.0"
  }
}
next.js github-actions monorepo turborepo
1个回答
0
投票

我认为你应该使用命令 npm ci。 在您的计算机上,首先运行 npm install 以生成名为 package-lock.json 的锁定文件。提交并在 GitHub Actions 工作流程中运行 npm ci。

文档:https://docs.npmjs.com/cli/v9/commands/npm-ci

© www.soinside.com 2019 - 2024. All rights reserved.