Skip to content

Cannot build app behind corporate proxy #858

Open
@mu88

Description

@mu88

Problem description

When trying to build a Electron.NET app on my company laptop behind a corporate proxy, it fails with an npm error although the environment variables HTTP_PROXY and HTTPS_PROXY are set.

Versions

  • Version: 23.6.2
  • .NET: 8.0.300
  • Node.js: 20.8.1
  • Target: Windows (electronize build /target win)

Steps to Reproduce

  1. Clone this repo: https://github.com/mu88/ElectronWebsiteWrapper
  2. Open PowerShell
  3. Run dotnet tool restore
  4. Run dotnet electronize build /target win

Logs

Build Electron Application...
Arguments:
        target = win
Build ASP.NET Core App for win-x64...
Executing dotnet publish in this directory: C:\work\GitHub\ElectronWebsiteWrapper\obj\desktop\win
Build ASP.NET Core App for win-x64 under Release-Configuration...
dotnet publish -r win-x64 -c "Release" --output "C:\work\GitHub\ElectronWebsiteWrapper\obj\desktop\win\bin" /p:PublishReadyToRun=true /p:PublishSingleFile=true --self-contained
dotnet publish -r win-x64 -c "Release" --output "C:\work\GitHub\ElectronWebsiteWrapper\obj\desktop\win\bin" /p:PublishReadyToRun=true /p:PublishSingleFile=true --self-contained
  Determining projects to restore...
  All projects are up-to-date for restore.
C:\Program Files\dotnet\sdk\8.0.300\Current\SolutionFile\ImportAfter\Microsoft.NET.Sdk.Solution.targets(36,5): warning NETSDK1194: The "--output" option isn't supported when building a solution. Specifying a solution-level output path results in all projects copying outputs to the same directory, which can lead to inconsistent builds. [C:\work\GitHub\ElectronWebsiteWrapper\ElectronWebsiteWrapper.sln]
  ElectronWebsiteWrapper -> C:\work\GitHub\ElectronWebsiteWrapper\bin\Release\net8.0\win-x64\ElectronWebsiteWrapper.dll
  ElectronWebsiteWrapper -> C:\work\GitHub\ElectronWebsiteWrapper\obj\desktop\win\bin\


Start npm install...
npm install --production
npm WARN config production Use `--omit=dev` instead.

added 48 packages, and audited 49 packages in 3s

found 0 vulnerabilities


ElectronHostHook handling started...
Build Electron Desktop Application...
Executing electron magic in this directory: C:\work\GitHub\ElectronWebsiteWrapper\bin\desktop
Create electron-builder configuration file...
node build-helper.js electron.manifest.json


Package Electron App for Platform win...
npx electron-builder --config=./bin/electron-builder.json --win --x64 -c.electronVersion=23.2.0
npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path C:\Users\myUser\AppData\Roaming\npm
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\myUser\AppData\Roaming\npm'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in: C:\Users\myUser\AppData\Local\npm-cache\_logs\2024-06-17T14_35_15_490Z-debug-0.log


... done

Further information

At the very beginning, only the environment variables HTTP_PROXY and HTTPS_PROXY were set on my laptop. This way, npm didn't restore any packages. I had to explicitly run npm config set proxy http://proxy.company.com:1234 to get to the current point.

The problem is not bound to this particular app - it also fails for https://github.com/mu88/BlazorFotoManager.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions