cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.69k stars 3.16k forks source link

Could not install cypress behind firewall - cannot read repository cypress-io/request.git #6752

Closed codegeass1 closed 4 years ago

codegeass1 commented 4 years ago

Current behavior:

This command worked for me until few hours (I saw that there was a new release)

CYPRESS_INSTALL_BINARY=${path}/cypress.zip npm install cypress

I get this error :

npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t ssh://git@github.com/cypress-io/request.git
npm ERR! Could not read from remote repository

Desired behavior:

Normally it should unzip the zipped cypress and install and I see the package in node_modules. I don't know why it is looking for that github repo.

Versions

3.8.0

jennifer-shehane commented 4 years ago

@SirineBeji You said 'last few hours', but you mention using 3.8.0 - the latest release is 4.2.0, so which binary are you using? - Because the binary cannot and will not change on Cypress end, it is downloaded on your system and not affected by new releases. You have to download the new release to have changes.

codegeass1 commented 4 years ago

I have tried with 4.2.0 it is the same it is trying to checkout ssh://git@github.com/cypress-io/request.git . Do you know why we are getting this behaviour ?

PetMou commented 4 years ago

I also have a problem installing 4.2.0 by CYPRESS_INSTALL_BINARY. returning the same error. We are behind a firewall, so direct download is not permitted. The installation hangs when trying to remove obsolete packages from the package tree. In my case "pend@1.2.0". Then I get

C:\Projecten\DWD>npm install cypress@4.2.0 --save-dev
npm ERR! Error while executing:
npm ERR! C:\Program Files\Git\cmd\git.EXE ls-remote -h -t ssh://git@github.com/cypress-io/request.git
npm ERR!
npm ERR! ssh: connect to host github.com port 22: Connection timed out
npm ERR! fatal: Could not read from remote repository.
npm ERR!
npm ERR! Please make sure you have the correct access rights
npm ERR! and the repository exists.
npm ERR!
npm ERR! exited with error code: 128

When I remove the package by hand and try it again, it hangs on the next one. Windows 10 environment, using IntelliJ. There is nothing wrong with the GIT installation itself, all other GIT actions run fine

textbook commented 4 years ago

I'm seeing this problem trying to create a multi-stage build of my app in a Docker container, using CYPRESS_INSTALL_BINARY=0 to prevent the binary being downloaded into the container per https://docs.cypress.io/guides/getting-started/installing-cypress.html#Environment-variables.

Relevant section of logs:

Step 8/24 : RUN npm ci
 ---> Running in 4679e167938c
npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno ENOENT
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://git@github.com/cypress-io/request.git
npm ERR! enoent 
npm ERR! enoent 
npm ERR! enoent spawn git ENOENT
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:
npm ERR!     /root/.npm/_logs/2020-03-17T06_44_36_291Z-debug.log
The command '/bin/sh -c npm ci' returned a non-zero code: 1
The command "docker build ." exited with 1.

Looks like a regression around handling of that env var in 4.2.0; the builds using 4.1.0 are still passing fine.

jennifer-shehane commented 4 years ago

I think this is related to this change in 4.2.0, but I'm not sure why: https://github.com/cypress-io/cypress/pull/6694

Konstruktour commented 4 years ago

since the update to 4.2.0 i have an additional entry in my (yarn) lockfile

"request@github:cypress-io/request#b5af0d1fa47eec97ba980cde90a13e69a2afcd16":
  version "2.88.1"
  resolved "https://codeload.github.com/cypress-io/request/tar.gz/b5af0d1fa47eec97ba980cde90a13e69a2afcd16"
  dependencies:
    aws-sign2 "~0.7.0"
    aws4 "^1.8.0"
    caseless "~0.12.0"
    combined-stream "~1.0.6"
    extend "~3.0.2"
    forever-agent "~0.6.1"
    form-data "~2.3.2"
    har-validator "~5.1.3"
    http-signature "~1.2.0"
    is-typedarray "~1.0.0"
    isstream "~0.1.2"
    json-stringify-safe "~5.0.1"
    mime-types "~2.1.19"
    oauth-sign "~0.9.0"
    performance-now "^2.1.0"
    qs "~6.5.2"
    safe-buffer "^5.1.2"
    tough-cookie "~2.5.0"
    tunnel-agent "^0.6.0"
    uuid "^3.3.2"

because my build is also behind a firewall, yarn tries to get to that url and fails...

Pegase745 commented 4 years ago

Yeah same as @Konstruktour , not sure it's related to this particular issue, but it's cumbersome for those who use Cypress this way

almeiduh commented 4 years ago

Hi, we're having the same issue as well. Temporarily solved it by restricting the version as follows in package.json:

"cypress": "~4.1.0"

mmussmann commented 4 years ago

I think you need to have git installed to use direct git links. We have the same issue, trying to roll back to 4.1

hanukatreddy commented 4 years ago

I have tried with 4.2.0 it is the same it is trying to checkout ssh://git@github.com/cypress-io/request.git . Do you know why we are getting this behaviour ?

i'm also facing same issue on cypress version 4.1.0 on a linux machine. After I removed cypress package from package.json, our jenkins jobs successfully deployed.

flotwig commented 4 years ago

That's strange, NPM should fall back to cloning the dependency via https if ssh is not working on your machine. git may be required as well.

To avoid this, Cypress's request fork should be published to NPM, and then we don't need to ship with a GitHub-backed NPM dependency that causes these issues for some users.

bahmutov commented 4 years ago

Yeah we should publish it under @cypress/request and only use npm registry

Sent from my iPhone

On Mar 18, 2020, at 15:51, Zach Bloomquist notifications@github.com wrote:

 That's strange, NPM should fall back to cloning the dependency via https if ssh is not working on your machine. git may be required as well.

To avoid this, Cypress's request fork should be published to NPM, and then we don't need to ship with a GitHub-backed NPM dependency that causes these issues for some users.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

cypress-bot[bot] commented 4 years ago

The code for this is done in cypress-io/cypress#6777, but has yet to be released. We'll update this issue and reference the changelog when it's released.

codegeass1 commented 4 years ago

Even with 3.8.0 it is doing this... I'm on linux and we do the following CYPRESS_INSTALL_BINARY=${path}/cypress.zip npm install cypress Git is correctly installed but we are behind a firewall. Our tests are blocked since three days. I don't know how this could happen with 3.8.0 and do we need to wait until a release is done ?

jennifer-shehane commented 4 years ago

@SirineBeji This should not happen in 3.8.0, ensure you are using 3.8.0 release zip. Is it the exact same error above mentioning ssh://git@github.com/cypress-io/request.git

Yes, this will be fixed in our next release estimated for Mar 30.

textbook commented 4 years ago

@SirineBeji, you're not using 3.8.0 for the install, npm install cypress will get the latest version from your registry. If you want consistency with the local binaries you're trying to reuse, try npm install cypress@3.8.0 (or use e.g. npm ci to install all packages at the versions specified in the lock file, for reproducible builds).

bbortt commented 4 years ago

Any chance to hotfix this? It's kind of annoying for everyone behind proxies.. ;) Or what's the release plan? Thanks!

jennifer-shehane commented 4 years ago

Workaround

Install Cypress 4.1.0 - that version does not have this issue. This will be fixed in our next release which is scheduled for Monday.

Konstruktour commented 4 years ago

This will be fixed in our next release which is scheduled for Monday.

@jennifer-shehane Whats the idea behind the release schedule? Do u have any general release plan? Or do u release when there are enough features / bugfixes ready? ;) Btw would be awesome, if you would have any notification system when there is a new release, eg. twitter about it :-)

jennifer-shehane commented 4 years ago

We release every 2 weeks, used to be on Friday - recently changed to Monday. We do releases sooner if something warrants a hotfix (aka something that does not have a workaround that is a blocker for enough users).

Ways to know there is a new release:

There's likely some utilities out there you could find to notify you on npm release or GitHub release.

Opened an issue in our docs to document this somewhere: https://github.com/cypress-io/cypress-documentation/issues/2661

errohitrana2013 commented 4 years ago

As you mention #6861 is duplicate for this issue. i have check with 4.1.0 also same error.

jennifer-shehane commented 4 years ago

@errohitrana2013 Please double check that you have a single source of Cypress version (if using yarn, sometimes multiple versions can be defined) - that you're not overriding it with a binary version, that you clean your node_modules.

It is impossible for this bug to appear in version 4.1.0 since the change to the cypress-io/request.git was added in 4.2.0.

errohitrana2013 commented 4 years ago

I have change the version :-1: { "name": "cypressautomation", "version": "4.1.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC" }

and executed this command

npm install cypress --save-dev

still same issue

errohitrana2013 commented 4 years ago

and i man not using yarn

jennifer-shehane commented 4 years ago

You need to change the cypress version in your devDependencies, not the version of your package.json file.

Run:

npm install cypress@4.1.0 --save-dev
Screen Shot 2020-03-27 at 4 57 45 PM copy
errohitrana2013 commented 4 years ago

Thanks jennifer.

I have changed:- i used app version : 1.0.0 and 1.2.3. Both time same error. { "name": "cypressautomation", "version": "1.0.0", "scripts": { "cypress:run": "cypress run --project cypress" }, "dependencies":{} "devDependencies":{ "cypress":"4.2.0" } }

Error>

0 info it worked if it ends with ok 1 verbose cli [ 1 verbose cli 'C:\Program Files\nodejs\node.exe', 1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js', 1 verbose cli 'install', 1 verbose cli 'cypress', 1 verbose cli '--save-dev' 1 verbose cli ] 2 info using npm@6.12.1 3 info using node@v12.13.1 4 verbose npm-session 85452af55fe2de12 5 silly install loadCurrentTree 6 silly install readLocalPackageData 7 timing stage:rollbackFailedOptional Completed in 7ms 8 timing stage:runTopLevelLifecycles Completed in 47ms 9 verbose stack Error: Failed to parse json 9 verbose stack Unexpected string in JSON at position 148 while parsing '{ 9 verbose stack "name": "cypressautomation", 9 verbose stack "vers' 9 verbose stack at parseError (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:469:11) 9 verbose stack at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:105:26) 9 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:52:5 9 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:115:16 9 verbose stack at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:61:3) 10 verbose cwd C:\Users\Happy_PC\CypressAutomation 11 verbose Windows_NT 6.3.9600 12 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "cypress" "--save-dev" 13 verbose node v12.13.1 14 verbose npm v6.12.1 15 error code EJSONPARSE 16 error file C:\Users\Happy_PC\CypressAutomation\package.json 17 error JSON.parse Failed to parse json 17 error JSON.parse Unexpected string in JSON at position 148 while parsing '{ 17 error JSON.parse "name": "cypressautomation", 17 error JSON.parse "vers' 18 error JSON.parse Failed to parse package.json data. 18 error JSON.parse package.json must be actual JSON, not just JavaScript. 19 verbose exit [ 1, true ]

textbook commented 4 years ago

@errohitrana2013 that error is unrelated to Cypress generally or this issue specifically; your package.json file is malformed.

errohitrana2013 commented 4 years ago

thanks very much. got the solution.

cypress-bot[bot] commented 4 years ago

Released in 4.3.0.

This comment thread has been locked. If you are still experiencing this issue after upgrading to Cypress v4.3.0, please open a new issue.