javascript - The cypress npm package is installed, but the Cypress binary is missing - Stack Overflow

Hello everyone i'm new with azure devops CIandi'm trying to reduice my pipeline build tim

Hello everyone i'm new with azure devops CI and i'm trying to reduice my pipeline build time by caching node_modules between jobs ,but i got this error that i can't resolve. i'm using cypress for testing. Here is my azure pipeline

# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# 

trigger:
- master

pool:
  vmImage: 'windows-2019'

variables:
  npm_config_cache: $(Pipeline.Workspace)/.npm
steps:
- task: NodeTool@0
  inputs:
    versionSpec: '10.x'
  displayName: 'Install Node.js'

- task: Cache@2
  inputs:
    key: 'npm | “$(Agent.OS)” | $(Build.SourcesDirectory)/package-lock.json'
    path: '$(Build.SourcesDirectory)/node_modules'
    cacheHitVar: 'CacheRestored'

- script: npm install
  displayName: 'npm install '
  condition: ne(variables['CacheRestored'], 'true')
  
- task: Npm@1
  inputs:
    mand: 'custom'
    customCommand: 'run scripts'
  continueOnError: false  
  displayName: 'Npm run test'

- task: PublishBuildArtifacts@1
  displayName: "Publish Artifact: cypress-and-azure-devops Screenshots"
  inputs:
    PathtoPublish: cypress/screenshots
    ArtifactName: CypressAndAzureDevopsTestRunScreenshots
  condition: failed()

- task: PublishBuildArtifacts@1
  displayName: "Publish Artifact: cypress-and-azure-devops Videos "
  inputs:
    PathtoPublish: cypress/videos
    ArtifactName: CypressAndAzureDevopsTestRunVideos
  condition: succeededOrFailed()

- task: PublishTestResults@2
  displayName: "Publish Test Results"
  condition: succeededOrFailed()
  inputs:
    testResultsFormat: "JUnit"
    testResultsFiles: "**/cypress-and-azure-devops-*.xml"
    failTaskOnFailedTests: true

Hello everyone i'm new with azure devops CI and i'm trying to reduice my pipeline build time by caching node_modules between jobs ,but i got this error that i can't resolve. i'm using cypress for testing. Here is my azure pipeline

# Node.js
# Build a general Node.js project with npm.
# Add steps that analyze code, save build artifacts, deploy, and more:
# https://learn.microsoft./azure/devops/pipelines/languages/javascript

trigger:
- master

pool:
  vmImage: 'windows-2019'

variables:
  npm_config_cache: $(Pipeline.Workspace)/.npm
steps:
- task: NodeTool@0
  inputs:
    versionSpec: '10.x'
  displayName: 'Install Node.js'

- task: Cache@2
  inputs:
    key: 'npm | “$(Agent.OS)” | $(Build.SourcesDirectory)/package-lock.json'
    path: '$(Build.SourcesDirectory)/node_modules'
    cacheHitVar: 'CacheRestored'

- script: npm install
  displayName: 'npm install '
  condition: ne(variables['CacheRestored'], 'true')
  
- task: Npm@1
  inputs:
    mand: 'custom'
    customCommand: 'run scripts'
  continueOnError: false  
  displayName: 'Npm run test'

- task: PublishBuildArtifacts@1
  displayName: "Publish Artifact: cypress-and-azure-devops Screenshots"
  inputs:
    PathtoPublish: cypress/screenshots
    ArtifactName: CypressAndAzureDevopsTestRunScreenshots
  condition: failed()

- task: PublishBuildArtifacts@1
  displayName: "Publish Artifact: cypress-and-azure-devops Videos "
  inputs:
    PathtoPublish: cypress/videos
    ArtifactName: CypressAndAzureDevopsTestRunVideos
  condition: succeededOrFailed()

- task: PublishTestResults@2
  displayName: "Publish Test Results"
  condition: succeededOrFailed()
  inputs:
    testResultsFormat: "JUnit"
    testResultsFiles: "**/cypress-and-azure-devops-*.xml"
    failTaskOnFailedTests: true
Share Improve this question asked Oct 14, 2020 at 15:24 MajdMajd 531 gold badge1 silver badge3 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 3

Do you get the error message similar to the following?

The cypress npm package is installed, but the Cypress binary is missing.
We expected the binary to be installed here: /xxx/.cache/Cypress/4.8.0/Cypress/Cypress
Reasons it may be missing:
- You're caching 'node_modules' but are not caching this path: /xxx/.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.

If so, according to the error log, it provides a workaround to this problem. You can try to run the cypress install mand again to fix the problem. Here is a case you can refer to.

In addition, the quotation mark of “$(Agent.OS)” should be like "$(Agent.OS)". Or you can choose to run the jobs in self-hosted agent, machine-level caches and configuration persist from run to run, which can boost speed.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744400737a4572371.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信