我尝试在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.
我运行了建议的命令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"
}
}
谁能给我指个正确的方向?
发布于 2020-07-03 02:47:24
您可能在两个不同的阶段运行npm install
和cypress run
。在这种情况下,cypress缓存无法持久化,因此建议在运行install
和cypress run/open
时使用CYPRESS_CACHE_FOLDER
选项。该命令将如下所示,
CYPRESS_CACHE_FOLDER=./tmp/Cypress yarn install
CYPRESS_CACHE_FOLDER=./tmp/Cypress npx cy run [--params]
发布于 2021-07-21 22:08:31
它帮助了我
.\node_modules\.bin\cypress.cmd install --force
https://stackoverflow.com/questions/62319657
复制相似问题