question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

npm postinstall fails behind an HTTPS proxy

See original GitHub issue

Current behavior:

I’m running behind an HTTPS corporate proxy configured with a self-signed certificate. This requires to setup the self-signed certificate with NODE_EXTRA_CA_CERTS environment variable.

yarn install cypress gives the following error (same with npm)

> cypress@2.1.0 postinstall /app/oison-frontend/node_modules/cypress
> node index.js --exec install

Installing Cypress (version: 2.1.0)

 ✖  Downloading Cypress
   → Cypress Version: 2.1.0
    Unzipping Cypress
    Finishing Installation
The Cypress App could not be downloaded.

Please check network connectivity and try again:
----------

URL: https://download.cypress.io/desktop/2.1.0?platform=linux&arch=x64
Error: self signed certificate in certificate chain
----------

Platform: linux (Debian - 8.10)
Cypress Version: 2.1.0

It seems NODE_EXTRA_CA_CERTS is not honored by the post installation script downloading cypress binary.

Desired behavior:

It should work

How to reproduce:

Come to my company and have fun configuring this proxy sh*t.

Additional Info (images, stack traces, etc)

It was working yesterday, so I think something has changed in the package of 2.1.0 release.

  • Operating System: Ubuntu
  • Cypress Version: >=2.1
  • Browser Version:

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:22
  • Comments:31 (8 by maintainers)

github_iconTop GitHub Comments

14reactions
gkemp94commented, Mar 3, 2018

I had this problem a few days ago and found that the best workaround was to download the zip file directly from the site then type the following command before attempting npm install. This should then install the file from your zip file. Hope that helps.

CYPRESS_BINARY_VERSION=/local/path/to/cypress.zip

12reactions
davidsteinslandcommented, Jan 25, 2019

Cypress should (at least) honor the following env vars, which is the de facto way of configuring proxy:

  • HTTP_PROXY / http_proxy
  • HTTPS_PROXY / https_proxy

Also, because it’s node:

  • NODE_EXTRA_CA_CERTS

And perhaps also the following npm configs:

  • cafile
  • https-proxy
  • proxy

Stuff like setting NODE_TLS_REJECT_UNAUTHORIZED=0 or similar is out of the question, and defeats the whole purpose of secure connections.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I solve the connection problem during npm install ...
Try this solution for installing electron node module from behind proxy. npx cross-env ELECTRON_GET_USE_PROXY=true ...
Read more >
ngrok - npm
If you are behind a corporate proxy and have issues installing ngrok, you can set HTTPS_PROXY env var to fix it. ngrok's postinstall...
Read more >
Working with NPM behind Network Proxy - Medium
NPM widely used to manage packages on Javascript project. This article demonstrates how to configure / set proxy for NPM to make it...
Read more >
Advanced Installation Instructions | Electron
To install prebuilt Electron binaries, use npm. ... If you need to use an HTTP proxy, you need to set the ELECTRON_GET_USE_PROXY variable...
Read more >
Configure your applications - develop-behind-proxy
If the environment variables are set, all post-install hooks should work properly. Certificate errors can be avoided by running npm config set strict-ssl...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found