TeamCity with npm - Error: ENOENT, stat 'C:\Windows\system32\config\systemprofile\AppData\Roaming\npm'

喜夏-厌秋 提交于 2019-12-22 07:04:39

问题


I'm having serious problems getting the last pieces of my TeamCity configuration in place.

I have a powershell step that executes the following commands:

& npm install
& grunt build

logging the following output:

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 that this is a known problem, but none of the solutions has worked for me so far.

My setup is the following: I have two virtual machines in Azure, build and agent. Both are connected to the same AD domain, domain, in which there is a user domain\teamcityuser, who is of "standard" class (i.e. not admin). This user runs both the build server (on the build instance) and the build agent (on the agent instance).

I've tried these things without success:

  • Creating the directory in the error message, making sure that domain\teamcityuser has full controll access rights to it.
  • Creating an npm directory under C:\Users\teamcityuser\AppData\Roaming
  • Creating a file C:\Windows\System32\config\SystemProfile\.npmrc with the contents prefix=C:\npm-global, as well as creating the latter folder
  • Running npm cache clean before running the build
  • Installing a global npm package through npm install -g npm

What more can I try to get this working?


And to avoid the XY problem, here's my actual problem:

I have a .NET Web API project with CI setup through this TeamCity installation, via Octopus Deploy and to the hosting server. I also have a github repo with the code for a web SPA that will consume the API. The spa is built with grunt build, after which there's a dist folder with everything I need to deploy.

I'd like to re-use as much as possible of the CI architecture to roll out the client too.


回答1:


Given that path to executable contains SysWOW64, this is an x32 Powershell, therefore, it refers to x32 system profile path, which is located at C:\Windows\sysWOW64\config\systemprofile. So, you need to use that path as your base in order to implement any workarounds, say, create C:\Windows\sysWOW64\config\systemprofile\AppData\Roaming\npm folder, and not plain C:\Windows\system32\config\systemprofile\AppData\Roaming\npm.



来源:https://stackoverflow.com/questions/31342624/teamcity-with-npm-error-enoent-stat-c-windows-system32-config-systemprofil

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!