英文:
Install and run go package task in Azure Dev Ops
问题
我想在将其打包为vsix扩展之前,剪裁我们的node_modules文件夹中的不必要的冗余内容。
这个工具node-prune很好用。在本地运行时,我使用chocolatey安装了它,但是在使用Azure DevOps作为我们的CI流程的一部分安装时,出现了node-prune未找到的问题。
- 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)'
英文:
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)'
答案1
得分: 2
为管道设置GO变量:
variables:
GOBIN: '$(GOPATH)/bin' # Go二进制文件路径
GOROOT: '/usr/local/go1.10' # Go安装路径
GOPATH: '$(system.defaultWorkingDirectory)/gopath' # Go工作区路径
看起来当前的PATH
中找不到node-prune
,你分享了YAML文件的一部分。
node-prune
必须在你的本地工作,因为GOPATH
已经定义,并且新的Go二进制文件存在于GOPATH/bin
下。
英文:
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论