steps:
- task: Cache@2
inputs:
key: 'npm | "$(Agent.OS)" | package-lock.json'
restoreKeys: |
npm | "$(Agent.OS)"
npm
path: '$(System.DefaultWorkingDirectory)/node_modules'
displayName: Cache npm
- script: 'npm cache clean --force'
displayName: 'Clean NPM cache'
rm -rf node_modules/
rm package-lock.json
npm install
注:以上代码示例为yaml和shell语言,实际应用中可根据具体情况相应地进行修改。