5

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.

Community
  • 1
  • 1
Tomas Aschan
  • 53,075
  • 51
  • 214
  • 362
  • Did you try creating `npm` folder under system profile? `C:\Windows\sysWOW64\config\systemprofile\AppData\Roaming\npm` – Vesper Jul 10 '15 at 14:00

1 Answers1

5

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.

Vesper
  • 18,037
  • 4
  • 33
  • 55
  • Fantastic! That got me further, but not all the way :/ The build now fails at `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.` It stops there even if I remove all `npm-cache` folders, both in `system32`, `sysWOW64` and the user's `AppData`, before starting the build... – Tomas Aschan Jul 10 '15 at 14:31
  • I did a brief search, that can be another bug https://github.com/npm/npm/issues/6309 So far can't help further, I'm out of time. – Vesper Jul 10 '15 at 14:34
  • Hm. Upgrading node (as suggested in that issue) seems to have helped with this. Thanks a lot! – Tomas Aschan Jul 10 '15 at 15:23