【发布时间】:2021-09-11 21:10:17
【问题描述】:
我正在尝试缓存我的 node_modules 以提高构建性能。
这是yaml:
pool:
vmImage: 'windows-latest'
variables:
ngWorkingDir: 'src\XXX\client'
npm_config_cache: $(Pipeline.Workspace)/.npm
CacheRestored: False
steps:
- task: Cache@2
inputs:
key: 'npm | "$(Agent.OS)" | $(ngWorkingDir)/package-lock.json'
restoreKeys: |
npm | "$(Agent.OS)"
path: '$(npm_config_cache)'
cacheHitVar: CacheRestored
displayName: Cache npm
- task: Npm@1
displayName: 'install node modules'
inputs:
workingDir: '$(ngWorkingDir)'
verbose: false
condition: eq(variables['CacheRestored'], False)
- task: Npm@1
displayName: ng lint
inputs:
command: 'custom'
workingDir: '$(ngWorkingDir)'
verbose: false
customCommand: 'run lint'
我无法让 ng lint 命令正常工作。作为第一步,我尝试全局安装 angular cli。但这也无济于事。
【问题讨论】:
-
您是否设法解决了您的问题?我遇到了类似的问题
标签: npm caching azure-devops azure-pipelines node-modules