我在将 TeamCity 配置的最后一部分安装到位时遇到严重问题。
我有一个执行以下命令的 powershell 步骤:
& npm install
& grunt build
记录以下输出:
Build (Powershell) (1s)
[13:18:08]PowerShell Executable: C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe
[13:18:08]Working directory: C:\BuildAgent\work\6a434ee5d01fd0d9
[13:18:08]PowerShell arguments: [-NonInteractive, -ExecutionPolicy, ByPass, -File, C:\BuildAgent\temp\buildTmp\powershell8407335260182621582.ps1]
[13:18:09]Error: ENOENT, stat 'C:\Windows\system32\config\systemprofile\AppData\Roaming\npm'
[13:18:09]
[13:18:09]grunt-cli: The grunt command line interface. (v0.1.13)
[13:18:09]Process exited with code 0
I've seen https://github.com/npm/npm/issues/1904这是一个known https://stackoverflow.com/questions/25093276/node-js-windows-error-enoent-stat-c-users-rt-appdata-roaming-npm问题,但都没有解决方案 https://github.com/npm/npm/wiki/Troubleshooting#error-enoent-stat-cusersuserappdataroamingnpm-on-windows-7到目前为止对我有用。
我的设置如下:我在 Azure 中有两个虚拟机,build
and agent
。两者都连接到同一个AD域,domain
,其中有一个用户domain\teamcityuser
,属于“标准”类别(即不是管理员)。该用户运行构建服务器(在build
实例)和构建代理(在agent
实例)。
我尝试过这些事情但没有成功:
- 创建错误消息中的目录,确保
domain\teamcityuser
对其拥有完全控制访问权限。
- 创建一个
npm
目录下C:\Users\teamcityuser\AppData\Roaming
- 创建文件
C:\Windows\System32\config\SystemProfile\.npmrc
与内容prefix=C:\npm-global
,以及创建后一个文件夹
- Running
npm cache clean
在运行构建之前
- 安装全局
npm
包通过npm install -g npm
我还可以尝试什么才能让它发挥作用?
并避免XY 问题 https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem,这是我的实际问题:
我有一个 .NET Web API 项目,通过此 TeamCity 安装、Octopus Deploy 和托管服务器进行 CI 设置。我还有一个 github 存储库,其中包含将使用 API 的 Web SPA 的代码。水疗中心是用grunt build
,之后有一个dist
包含我需要部署的所有内容的文件夹。
我也想尽可能多地重用 CI 架构来推出客户端。