如何解决:Circleci上找不到纱线包装?

发布于 2025-01-31 18:19:05 字数 1752 浏览 5 评论 0原文

我一直在尝试通过建立简单的工作来学习Circleci工作流程,并且我一直遇到此错误: /bin/bash:纱线:找不到命令

因此,所有步骤都会运行,但是当涉及到工作时,它就停止了。因此,旋转环境,准备ENV变量,结帐代码,还原纱线软件包缓存是绿色的(成功)。

我的工作流程下面:


default-environment: &default-environment
  docker:
    - image: cimg/base:2020.01

step-restore-build-cache: &step-restore-build-cache
  restore_cache:
    name: Restore Yarn Package Cache
    keys:
      - yarn-packages-{{ checksum "yarn.lock" }}

step-save-build-cache: &step-save-build-cache
  save_cache:
    name: Save Yarn Package Cache
    key: yarn-packages-{{ checksum "yarn.lock" }}
    paths:
      - ~/.cache/yarn

step-run-cache: &step-run-cache
  run:
    name: Install Dependencies
    command: yarn install --immutable

version: 2.1
jobs:
  build:
    <<: *default-environment
    steps:
      - checkout
      - <<: *step-restore-build-cache
      - run:
          name: Build
          command: yarn run build
      - <<: *step-save-build-cache
  lint:
    <<: *default-environment
    steps:
      - checkout
      - <<: *step-restore-build-cache
      - run:
          name: Lint
          command: yarn run lint
  format:
    <<: *default-environment
    steps:
      - checkout
      - <<: *step-restore-build-cache
      - run:
          name: Format
          command: yarn run format
  type-check:
    <<: *default-environment
    steps:
      - checkout
      - <<: *step-restore-build-cache
      - run:
          name: Type-check
          command: yarn run type-check
workflows:
  version: 2
  build-and-lint:
    jobs:
      - build
      - lint
      - format
      - type-check

不确定如何解决此问题..

非常感谢:)

I have been trying to learn CircleCi workflows by building simple jobs and I keep getting this error:
/bin/bash: yarn: command not found.

So all the steps run but when it comes to the job is self it stops. So spin up environment, preparing env variables, checkout code, Restore Yarn Package Cache are green(successful).

My workflow below:


default-environment: &default-environment
  docker:
    - image: cimg/base:2020.01

step-restore-build-cache: &step-restore-build-cache
  restore_cache:
    name: Restore Yarn Package Cache
    keys:
      - yarn-packages-{{ checksum "yarn.lock" }}

step-save-build-cache: &step-save-build-cache
  save_cache:
    name: Save Yarn Package Cache
    key: yarn-packages-{{ checksum "yarn.lock" }}
    paths:
      - ~/.cache/yarn

step-run-cache: &step-run-cache
  run:
    name: Install Dependencies
    command: yarn install --immutable

version: 2.1
jobs:
  build:
    <<: *default-environment
    steps:
      - checkout
      - <<: *step-restore-build-cache
      - run:
          name: Build
          command: yarn run build
      - <<: *step-save-build-cache
  lint:
    <<: *default-environment
    steps:
      - checkout
      - <<: *step-restore-build-cache
      - run:
          name: Lint
          command: yarn run lint
  format:
    <<: *default-environment
    steps:
      - checkout
      - <<: *step-restore-build-cache
      - run:
          name: Format
          command: yarn run format
  type-check:
    <<: *default-environment
    steps:
      - checkout
      - <<: *step-restore-build-cache
      - run:
          name: Type-check
          command: yarn run type-check
workflows:
  version: 2
  build-and-lint:
    jobs:
      - build
      - lint
      - format
      - type-check

Not really sure how to fix this..

Thank you very much :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

垂暮老矣 2025-02-07 18:19:05

您正在使用CIMG/base:2020.01,它是通用图像,没有节点或安装纱线二进制。您应该使用 cimg/node 带有Yarn Pre-in-pre-installed的图像。

You're using cimg/base:2020.01 which is a general purpose image and does not have node or the yarn binary installed. You should use the cimg/node image which has yarn pre-installed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文