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
1 Answer
Reset to default 3Do 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条)