Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm install not working behind corporate firewall #733

Closed
BasieP opened this Issue Oct 12, 2017 · 18 comments

Comments

@BasieP
Copy link

BasieP commented Oct 12, 2017

I have troubles installing the npm package behind a corporate firewall due to the download of an executeable included in the post-install of the npm package.

Right now this is how my output looks like:

d:\Workspace\myproj>npm install cypress --save-dev

> cypress@1.0.1 postinstall d:\Workspace\myproj\node_modules\cypress
> node index.js --exec install

Installing Cypress (version: 1.0.1)

 V  Downloaded Cypress
 ×  Unzipping Cypress
   → Cypress Version: 1.0.1
    Finishing Installation
The Cypress App could not be unzipped.

Search for an existing issue or open a GitHub issue at

https://github.com/cypress-io/cypress/issues
----------

Error: end of central directory record signature not found
----------

Probably the downloaded file (zip i guess) gets replaced by a html page of my proxy.
therefore the download is successfull, but the unzip fails

I'm hoping for some way to resolve this for all our big banks, goverments and other companies where we don't blindly trust executables download off the internet.

I don't know much about the logic behind Cypress, but i noticed the CLI is binary, so if that is the problem, please split the package into 2 different NPM packages.
I won't be needing the CLI anyway.

@RandallKent

This comment has been minimized.

Copy link
Member

RandallKent commented Oct 12, 2017

@BasieP - Have you tried the Direct Download? That should hopefully get you up and running while the community looks into this issue further.

@tgelu

This comment has been minimized.

Copy link

tgelu commented Oct 19, 2017

+1 :( the link to direct download is blocked behind my organisation's firewall

@MarcLoupias

This comment has been minimized.

Copy link

MarcLoupias commented Oct 19, 2017

@tgelu is your organization using something like JFrog Artifactory or do they allow direct download from the npm registry ?

When sysadmins blocks downloads from the outside world the solution is to use something like artifactory to act like a proxy with an appropriate network config for that "proxy". That way they can control what it is goin on on their network instead of letting anybody doing everything.

For example when you run npm install cypress the artifactory will download from the internet and when it will be available your npm client will download it from your local network and not from the internet.

I am pretty sure it is possible to configure artifactory to act the same way with external downloads fired from npm installation scripts.

So npm install cypress will download cypress package from your artifactory and when cypress will try to download from https://download.cypress.io/xxxxx it will download from artifactory also.

I will have to fix this issue also but later. For now the direct download is available to me so i have what i need to convince my hierarchy to heavily use cypress :-)

I don't think the bug label is appropriate here. At best you (cypress.io) could embark everything in the cypress package (every platform and arch available) but the direct download package is a 500mo stuff which seems too heavy for the npm registry.

@brian-mann brian-mann added stage: wontfix and removed type: bug labels Oct 19, 2017

@IcodeNet

This comment has been minimized.

Copy link

IcodeNet commented Oct 22, 2017

Guys this seems the same problem that people are having with chromedriver behind corporate networks.
In particular the issue has to do with the usage of https: in the download link
The solution for chrome driver is to be able to specify and alternate location for the download through the npm config.
So if cypress while installing was checking npm connfig for a "cypress-cdnurl" and that url was local to the network then there woud not be an issue.
For completness what I do with Chromedriver is set in my npm config file
...chromedriver_cdnurl=http://someServer/chromedriver ..

@bahmutov

This comment has been minimized.

Copy link
Collaborator

bahmutov commented Oct 22, 2017

@IcodeNet

This comment has been minimized.

Copy link

IcodeNet commented Oct 23, 2017

For completeness based on @bahmutov very helpful hint what you need to do
(if your network blocks downloads or mess with certificates so that you cannot download from https://)
is the following:
Download and store somewhere on your network the cypress.zip file.
Then expose this file through a URL under https://
Then set either in your environment variables a
CYPRESS_BINARY_VERSION=https://someserver/cypress.zip

This is very important as the code that installs cypress has a function that checks if the alternative location for the binary starts with /^https:/

You can also pass at the command prompt the same
>set CYPRESS_BINARY_VERSION=https://someserver/cypress.zip&& npm i cypress -D

Ideally this should not be the case as the ceremony is greater than it should.
IMHO I think any local path could do such as C:\dev\cypress.zip
this way it would be easier to install behind proxies or networks that block zip downloads and point to a local folder. Especially useful for CI servers

@bahmutov

This comment has been minimized.

Copy link
Collaborator

bahmutov commented Oct 23, 2017

Good suggestion @IcodeNet and set CYPRESS_BINARY_VERSION=/some/path/to/cypress.zip environment variable ~~~already supports file path~~~. So if your proxy does not allow whitelisting https://download.cypress.io domain you could download cypress.zip for your platform and provide direct filepath on the test worker machine.

Edited: file path support has not been released yet, watch #701

@bahmutov

This comment has been minimized.

Copy link
Collaborator

bahmutov commented Oct 23, 2017

Please watch cypress-io/cypress-documentation#121 where I will document CYPRESS_BINARY_VERSION variable

@BasieP

This comment has been minimized.

Copy link
Author

BasieP commented Dec 4, 2017

it works nice with the CYPRESS_BINARY_VERSION variable, but there is still the bug of it only working with https
we have an internal nexus on http (not secure) and the CYPRESS_BINARY_VERSION variable doesn't work on http sites....
can that be fixed? i can make a PR if needed

@RandallKent

This comment has been minimized.

Copy link
Member

RandallKent commented Dec 4, 2017

@BasieP - PRs are always welcome! 😄

@simonatorw

This comment has been minimized.

Copy link

simonatorw commented Dec 20, 2017

This is the only thing preventing me from using this really nice software. For the time being, I'm stuck with the crappy alternatives :(

@brian-mann

This comment has been minimized.

Copy link
Member

brian-mann commented Dec 20, 2017

@simonatorw @BasieP is this still the case? There's a problem with http ? We fixed that in 1.1.4 https://docs.cypress.io/guides/references/changelog.html#1-1-4

@BasieP

This comment has been minimized.

Copy link
Author

BasieP commented Dec 20, 2017

@simonatorw

This comment has been minimized.

Copy link

simonatorw commented Dec 20, 2017

Hello, thx for your reply. I was able to overcome the problem with the env var solution. Thx. Is it possible to have npm just fetch the zip by default? Wouldn't that solve the problem without setting the env var? As you say, the custom path won't be saved in package.json so someone else cannot do a new npm i and be able to install cleanly.

@jennifer-shehane jennifer-shehane referenced this issue Mar 16, 2018

Open

Fix corporate proxy issues #1469

10 of 10 tasks complete
@TimoPot

This comment has been minimized.

Copy link

TimoPot commented May 30, 2018

why not place the cypress.zip file in the GitHub project?
My company does not block zip file downloads from GitHub.
CYPRESS_BINARY_VERSION can then point to the zip file on GitHub.

@chris-kobrzak

This comment has been minimized.

Copy link

chris-kobrzak commented Jun 18, 2018

In Cypress version 3+ you will need to unset CYPRESS_BINARY_VERSION and use CYPRESS_INSTALL_BINARY instead.

@TimoPot

This comment has been minimized.

Copy link

TimoPot commented Jun 18, 2018

Thank you @chris-kobrzak. True but that does not solve my issue

@brian-mann

This comment has been minimized.

Copy link
Member

brian-mann commented Jun 18, 2018

@TimoPot you can download the binary and host yourself if you'd like. That would be the easiest way to get it inside your network.

@flotwig flotwig referenced this issue Feb 20, 2019

Open

Improved proxy support #3531

27 of 36 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.