we have a selfhosted Azure DevOps Server with selfhosted Build Agents. The Agents are installed as a Windows Service with user NetworkService
.
Our project contains a .NET Application with public and private (selfhosted Repository) NuGet Packages and an angular WebApplication.
For the NuGet Repositories we configured global environment variables HTTP_PROXY
and HTTPS_PROXY
. The .NET part works fine.
The npm install
step does not work with the error message:
npm ERR! Cannot read property 'startsWith' of null
Seems like npm does not like the proxy settings in environment variables and no proxy settings in .npmrc file.
My question is, how can i configure npm to use proxy settings? How can i configure .npmrc file for user NetworkService
?
The build log contains following messages:
metrics-registry = "https://registry.npmjs.org/" scope = "" user-agent = "npm/6.14.13 node/v14.17.0 win32 x64"
; environment configs userconfig = "E:\Agent_02\_work\3\npm\15146.npmrc"
; builtin config undefined prefix = "C:\WINDOWS\ServiceProfiles\NetworkService\AppData\Roaming\npm"
; node bin location = E:\Program Files\nodejs\node.exe ; cwd = E:\Agent_02_work\3\s\Merida.UI.Web ; HOME = C:\WINDOWS\ServiceProfiles\NetworkService ; "npm config ls -l" to show all defaults.
[command]C:\WINDOWS\system32\cmd.exe /D /S /C ""E:\Program Files\nodejs\npm.cmd" install" npm ERR! Cannot read property 'startsWith' of null
As you can see the build takes a .npmrc file from path: E:\\Agent_02\\_work\\3\\npm\\15146.npmrc
. Each build the file path is different.
How can i solve this problem?
Thanks in advance