【问题标题】:TeamCity with npm - Error: ENOENT, stat 'C:\Windows\system32\config\systemprofile\AppData\Roaming\npm'带有 npm 的 TeamCity - 错误:ENOENT,stat 'C:\Windows\system32\config\systemprofile\AppData\Roaming\npm'
【发布时间】:2015-09-29 07:29:50
【问题描述】:

我在完成 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

seen 认为这是 known 问题,但到目前为止,solutions 都没有为我工作。

我的设置如下:我在 Azure 中有两台虚拟机,buildagent。两者都连接到同一个 AD 域 domain,其中有一个用户 domain\teamcityuser,他是“标准”类(即不是管理员)。该用户同时运行构建服务器(在build 实例上)和构建代理(在agent 实例上)。

我尝试了这些方法但没有成功:

  • 在错误消息中创建目录,确保domain\teamcityuser 对其具有完全控制访问权限。
  • C:\Users\teamcityuser\AppData\Roaming 下创建npm 目录
  • 使用内容prefix=C:\npm-global 创建文件C:\Windows\System32\config\SystemProfile\.npmrc,以及创建后一个文件夹
  • 在运行构建之前运行 npm cache clean
  • 通过npm install -g npm 安装全局npm

我还可以尝试什么来使它正常工作?


为了避免the XY problem,这是我的实际问题:

我有一个 .NET Web API 项目,通过此 TeamCity 安装、Octopus Deploy 和托管服务器进行 CI 设置。我还有一个 github 存储库,其中包含将使用 API 的 Web SPA 的代码。 spa 是用grunt build 构建的,之后有一个dist 文件夹,其中包含我需要部署的所有内容。

我也想尽可能多地重复使用 CI 架构来推出客户端。

【问题讨论】:

  • 您是否尝试在系统配置文件下创建npm 文件夹? C:\Windows\sysWOW64\config\systemprofile\AppData\Roaming\npm

标签: powershell azure npm teamcity teamcity-9.1


【解决方案1】:

鉴于可执行文件的路径包含 SysWOW64,这是一个 x32 Powershell,因此,它指的是位于 C:\Windows\sysWOW64\config\systemprofile 的 x32 系统配置文件路径。因此,您需要使用该路径作为基础以实施任何变通方法,例如创建 C:\Windows\sysWOW64\config\systemprofile\AppData\Roaming\npm 文件夹,而不是普通的 C:\Windows\system32\config\systemprofile\AppData\Roaming\npm

【讨论】:

  • 太棒了!这让我更进一步,但并非一直如此:/ 构建现在在npm ERR! EEXIST, open 'C:\Windows\system32\config\systemprofile\AppData\Roaming\npm-cache\2d6d37d2-m-cache-lodash-2-4-2-package-tgz.lock' Move it away, and try again. 处失败即使我删除了所有npm-cache 文件夹,包括system32sysWOW64 和用户的AppData,之前开始构建...
  • 我做了一个简短的搜索,这可能是另一个错误github.com/npm/npm/issues/6309 到目前为止无法进一步帮助,我没时间了。
  • 嗯。升级节点(如该问题中所建议的)似乎对此有所帮助。非常感谢!
猜你喜欢
  • 2014-12-23
  • 2014-09-26
  • 2023-04-01
  • 1970-01-01
  • 1970-01-01
  • 2021-06-08
  • 2018-02-01
  • 2017-07-29
  • 1970-01-01
相关资源
最近更新 更多