如何解决:Circleci上找不到纱线包装?
我一直在尝试通过建立简单的工作来学习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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在使用
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.