gpt4 book ai didi

docker - 如何解决 "The cypress npm package is installed, but the Cypress binary is missing."

转载 作者:行者123 更新时间:2023-12-02 18:59:02 29 4
gpt4 key购买 nike

我正在尝试在 GitLab CI 运行程序中下载并安装 Cypress 并获得此错误输出:

The cypress npm package is installed, but the Cypress binary is missing.
We expected the binary to be installed here: /root/.cache/Cypress/4.8.0/Cypress/Cypress
Reasons it may be missing:
- You're caching 'node_modules' but are not caching this path: /root/.cache/Cypress
- You ran 'npm install' at an earlier build step but did not persist: /root/.cache/Cypress
Properly caching the binary will fix this error and avoid downloading and unzipping Cypress.
Alternatively, you can run 'cypress install' to download the binary again.

我运行了建议的命令 cypress install但这没有帮助。
接下来是 You're caching 'node_modules' but are not caching this path: /root/.cache/Cypress我不明白您如何缓存模块并省略其路径。
接下来是 You ran 'npm install' at an earlier build step but did not persist我确实有 npm install在早期版本中,所以我将其替换为 npm ci在这种情况下,正如 Cypress 官方文档中所推荐的那样。

虽然没有分辨率。

以下是发生错误的相关行:

在 Dockerfile 内部:
COPY package.json /usr/src/app/package.json
COPY package-lock.json /usr/src/app/package-lock.json
RUN npm ci

在测试运行器内部:
docker-compose -f docker-compose-prod.yml up -d --build
./node_modules/.bin/cypress run --config baseUrl=http://localhost

在 package.json 中:
{
"name": "flask-on-docker",
"dependencies": {
"cypress": "^4.8.0"
}
}

谁能指出我正确的方向?

最佳答案

您可能正在运行 npm installcypress run在两个不同的阶段。这种情况下 cypress 缓存无法持久化,建议使用 CYPRESS_CACHE_FOLDER运行时的选项install以及cypress run/open .该命令将如下所示,

CYPRESS_CACHE_FOLDER=./tmp/Cypress yarn install

CYPRESS_CACHE_FOLDER=./tmp/Cypress npx cy run [--params]

关于docker - 如何解决 "The cypress npm package is installed, but the Cypress binary is missing.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62319657/

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