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

create-react-app trying to get compression lib over HTTP instead of HTTPS - failing behind proxy #4588

Closed
seanlmcgill opened this issue Jun 7, 2018 · 6 comments

Comments

@seanlmcgill
Copy link

Is this a bug report?

Yes

Did you try recovering your dependencies?

$ npm --version
6.1.0
$ yarn --version
1.7.0

Which terms did you search for in User Guide?

(Write your answer here if relevant.)

Environment

Environment:
OS: Windows 7
Node: 10.4.0
Yarn: 1.7.0

Steps to Reproduce

  1. create-react-app failing behind our corporate proxy. Yarn seems to use HTTP rather than HTTPS to get the 'compression' library - my company uses 'Forcepoint' and it is blocking HTTP traffic to npmjs. Not sure why this one library is not being fetched via HTTPS.

Note the verbose log output from create-react-app, this happens consistently. Everything up until the compression library works as its getting fetched via HTTPS:

verbose 25.081 Request "https://registry.npmjs.org/object-copy" finished with status code 200.
verbose 25.086 Performing "GET" request to "https://registry.npmjs.org/copy-descriptor".
verbose 25.243 Request "https://registry.npmjs.org/copy-descriptor" finished with status code 200.
[2/4] Fetching packages...
verbose 25.502 Performing "GET" request to "http://registry.npmjs.org/compression/-/compression-1.7.2.tgz".
verbose 25.554 Error: http://registry.npmjs.org/compression/-/compression-1.7.2.tgz: Invalid tar header. Maybe the tar is c
orrupted or it needs to be gunzipped?

at Object.module.exports.exports.decode (C:\Users\smcgill\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:77578:43)
at Extract.onheader (C:\Users\smcgill\AppData\Roaming\npm\node_modules\yarn\lib\cli.js:146111:39)

Expected Behavior

Create a new react app

Actual Behavior

Fails consistently trying to download compression library due to our website filtering infrastructure blocking HTTP traffic to npmjs

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

@seanlmcgill seanlmcgill changed the title Yarn trying to get compression lib over HTTP instead of HTTPS - failing behind proxy create-react-app trying to get compression lib over HTTP instead of HTTPS - failing behind proxy Jun 7, 2018
@EthanC
Copy link

EthanC commented Jun 15, 2018

Can reproduce, have yet to find a fix. Works fine with NPM.

Environment

  • Windows 10 1803 17134.112 x64
  • Node 8.11.3 or 10.4.1
  • Yarn 1.6.0 or 1.7.0 or 1.9.0-20180614.1132
  • Network: Wired, No Proxy, 20ms Ping, 94Mbps Download, 11Mbps Upload, 1.1.1.1 DNS

Attempted Fixes

  • Reinstalling Yarn and Node (multiple versions)
  • Admin Terminal (PowerShell)
  • Clearing Yarn and NPM Cache
  • Reinstalling (globally) create-react-app
  • Clearing DNS Cache
  • Restarting PC

Verbose Output

...
verbose 65.602 Performing "GET" request to "https://registry.yarnpkg.com/react/-/react-16.4.1.tgz".
verbose 65.603 Performing "GET" request to "https://registry.yarnpkg.com/react-dom/-/react-dom-16.4.1.tgz".
verbose 65.613 Performing "GET" request to "https://registry.yarnpkg.com/react-scripts-ts/-/react-scripts-ts-2.16.0.tgz".
info There appears to be trouble with your network connection. Retrying...
verbose 78.42 Performing "GET" request to "http://registry.npmjs.org/compression/-/compression-1.7.2.tgz".
info There appears to be trouble with your network connection. Retrying...
verbose 96.48 Performing "GET" request to "http://registry.npmjs.org/compression/-/compression-1.7.2.tgz".
verbose 112.552 Error: http://registry.npmjs.org/compression/-/compression-1.7.2.tgz: socket hang up
    at createHangUpError (_http_client.js:313:15)
    at Socket.socketOnEnd (_http_client.js:416:23)
    at Socket.emit (events.js:187:15)
    at endReadableNT (_stream_readable.js:1081:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
error An unexpected error occurred: "http://registry.npmjs.org/compression/-/compression-1.7.2.tgz: socket hang up".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\Ethan\\Documents\\Elite\\Frontend\\web\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Aborting installation.
  yarnpkg add --exact react react-dom react-scripts-ts --cwd C:\Users\Ethan\Documents\Elite\Frontend\web --verbose has failed.

Deleting generated file... package.json
Deleting generated file... yarn-error.log
Done.

@rodoabad
Copy link

I don't think this is a create-react-app issue. More like yarn.

@shleycarter
Copy link

shleycarter commented Jun 25, 2018

@rodoabad I was having this issue as well so I looked through the yarn issues and found issue #746. Someone had said they disabled their antivirus which solved their problem with socket hang ups. I was running Malwarebytes and upon quitting it, I no longer had this error.

@EthanC
Copy link

EthanC commented Jun 25, 2018

@shleycarter Thank you, this seems to have been my problem as well. Have you figured a solution on what to add to Malwarebytes' Exclusions List, rather than disabling protection as a whole?

EDIT: Latest Malwarebytes update fixes this issue!

@robertmylne
Copy link

For me turning off Windows Defender worked.

@LoganHeinzelman
Copy link

Turning off windows defender also worked.

@lock lock bot locked and limited conversation to collaborators Jan 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants