gpt4 book ai didi

powershell - 在 VSTS 托管构建代理上的 Powershell 中运行自定义 npm 命令

转载 作者:行者123 更新时间:2023-12-02 22:46:10 25 4
gpt4 key购买 nike

我需要迭代运行 npm 命令,并希望在 VSTS 构建步骤中通过 PowerShell 任务执行此操作。我无法使用 "npm <command>"在 PowerShell 中,并且还尝试使用 "C:\Program Files\nodejs\npm.cmd" "<command>" 运行命令和 Invoke-Expression "C:\Program Files\nodejs\npm.cmd" "<command>"在 VSTS 托管构建代理上的 PowerShell 中。如何从 PowerShell 构建步骤运行 npm 命令?

此外,<command>是来自我的 package.json 文件的自定义脚本。它不需要是定制的。我只是把它放在那里调用自定义 npm VSTS 构建步骤。

最佳答案

您可以使用托管代理直接通过 PowerShell 任务调用 npm 命令。

确保 工作文件夹 (package.json 文件夹路径)的 PowerShell 任务是对的。

关于package.json中的自定义脚本,你需要像npm run [script key]一样调用它.

关于powershell - 在 VSTS 托管构建代理上的 Powershell 中运行自定义 npm 命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48471285/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com