我在项目中有一组构建步骤(Team City 9.0c)
其中一个正在运行bower install
,这是一个没有参数的简单命令行执行。
Bower安装在系统上(我可以在机器上的命令提示符下运行它)但是我收到以下错误
[10:47:35][Step 2/7] Starting: D:\TeamCity\buildAgent\temp\agentTmp\custom_script8385462966123630321.cmd
[10:47:35][Step 2/7] in directory: D:\TeamCity\buildAgent\work\5d43cd6017ab83d4\website\Amaze.Web
[10:47:37][Step 2/7] 'bower' is not recognized as an internal or external command,
[10:47:37][Step 2/7] operable program or batch file.
[10:47:37][Step 2/7] Process exited with code 1
[10:47:37][Step 2/7] Step Bower (Command Line) failed
我之前看到PATH
未将c:\users\xxxx\roaming\...
设置为PATH
中npm二进制文件的位置,因此TC用户无法找到它们,但npm
是正确的。
grunt
和{{1}}都能成功运作。可能导致这种情况的原因是什么?
答案 0 :(得分:1)
路径变量是否定义了用户变量?如果是这样,它应该是一个系统变量,将由TeamCity流程使用。
答案 1 :(得分:0)
You haven't written which accounts the build agent runs as.
I had a similar problem and my build agent was running using Local System. I had to create a dedicated windows user account for the teamcity build agent, in the build script I added
npm install -g bower
set path=%path%;c:\path_to_bower_for_this_user;