为什么 Turbo 在我的工作流程中不可用,即使我安装了它?

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

当我尝试运行

turbo run lint
时,我收到一条消息“turbo:找不到命令”。看来上一步中 dev 依赖没有正确安装。

这是日志输出:

Actions log

这是我的工作流程:

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

这里是负责安装依赖项的包,其中有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 turborepo
1个回答
0
投票

尝试在turbo命令之前添加npx,也应该使用命令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.