简体   繁体   中英

Install and run go package task in Azure Dev Ops

I want to prune our node_modules folder of unnecessary bloat before it is packaged as a vsix extension.

This tool works well node-prune . Running locally I installed it with chocolatey - but trying to install it as part of our CI pipeline with Azure Dev ops - I get node-prune not found.

      - task: GoTool@0
        displayName: Install Go
        inputs:
          version: '1.10' 

      - task: Go@0
        displayName: Install Node-Prune
        inputs:
          command: 'get'
          arguments: 'github.com/tj/node-prune'

      - task: Go@0
        displayName: Prune Node Modules
        inputs:
          command: 'custom'
          customCommand: 'node-prune'
          arguments: '$(projectDirectory)'

Set the GO variables for the pipeline:

variables:
  GOBIN:  '$(GOPATH)/bin' # Go binaries path
  GOROOT: '/usr/local/go1.10' # Go installation path
  GOPATH: '$(system.defaultWorkingDirectory)/gopath' # Go workspace path

It seems that node-prune is not found in the current PATH , you shared a part of the YAML file.

node-prune must work in your local since the GOPATH is already defined, and new Go binaries exist under GOPATH/bin

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM