roa*_*ner 9 npm docker gitlab-ci cypress
我正在尝试在 GitLab CI runner 中下载并安装 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.
Run Code Online (Sandbox Code Playgroud)
我运行了建议的命令,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
Run Code Online (Sandbox Code Playgroud)
在测试运行器内:
docker-compose -f docker-compose-prod.yml up -d --build
./node_modules/.bin/cypress run --config baseUrl=http://localhost
Run Code Online (Sandbox Code Playgroud)
在 package.json 中:
{
"name": "flask-on-docker",
"dependencies": {
"cypress": "^4.8.0"
}
}
Run Code Online (Sandbox Code Playgroud)
谁能指出我正确的方向?
小智 14
您可能正在跑步npm install并且cypress 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]
Run Code Online (Sandbox Code Playgroud)
小智 10
这对我有帮助(Windows):
.\node_modules\.bin\cypress.cmd install --force
Run Code Online (Sandbox Code Playgroud)
或者,如果您使用的是 UNIX 系统:
./node_modules/.bin/cypress install --force
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6991 次 |
| 最近记录: |