問題描述
TFS 構建中的 npm install 拋出“未找到:git” (npm install in TFS build throws "not found: git")
我為 windows 和 node.js 安裝了 Git,它們都在系統的變量“Path”上並且可用。
我在項目中有 packages.json 文件,並且有 TFS 構建步驟定義可以這樣調用它:
<Target Name="BeforeBuild">
<Exec Command="npm install" />
</Target>
當我轉到 TFS 服務器並在我的項目目錄中執行“npm install”時,所有包設置正確。
當 TFS 在構建過程中執行“npm install”時,我收到此錯誤: EXEC (0, 0) not found: git
參考解法
方法 1:
Ran into the same issue with Bamboo. TFS is running as a service and the service account's PATH may be different than what you're seeing here. If you can , log in to the TFS user's account and adjust the "User Variables" to include you path to Git. The application is likely taking the "user path variable" instead of combining the "user" and "system" paths.
(by Denis、devduderino)