Yes
$ npm --version
6.1.0
$ yarn --version
1.7.0
(Write your answer here if relevant.)
Environment:
OS: Windows 7
Node: 10.4.0
Yarn: 1.7.0
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\smcgillAppData\Roaming\npm\node_modulesyarn\lib\cli.js:77578:43)
at Extract.onheader (C:\Users\smcgillAppData\Roaming\npm\node_modulesyarn\lib\cli.js:146111:39)
Create a new react app
Fails consistently trying to download compression library due to our website filtering infrastructure blocking HTTP traffic to npmjs
(Paste the link to an example project and exact instructions to reproduce the issue.)
Can reproduce, have yet to find a fix. Works fine with NPM.
...
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.
I don't think this is a create-react-app
issue. More like yarn
.
@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.
@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!
For me turning off Windows Defender worked.
Turning off windows defender also worked.
Most helpful comment
@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.