Posts Learn Components Snippets Categories Tags Tools new About
/

How to Fix Yarn Trouble With Network Connection

Learn how to solve "There appears to be trouble with your network connection" when running the yarn command using these simple steps

Created on Nov 08, 2021

12 views

Sometimes you might come across an error in the Yarn command that output "There appears to be trouble with your network connection. Retrying". In this short snippet, you will learn how to fix this error.

Fix Option 1: Update Yarn and Node


The first thing to do if you have this error is to update the yarn command to the latest version as well as Node Js to the latest LTS version. Often times this will do the trick and you will be able to run the yarn command as you normally would.

If you are on macOS then you might be using homebrew so here's the update command for yarn and node.
brew upgrade yarn
brew upgrade node

Fix Option 2: Using some Voodoos


The second fix is to try some voodoo.
1st - Delete any "*.lock" and rm node_modules or rm -rf node_modules/
rm node_modules/

rm -rf node_modules/
2nd - Clean a flush all connections things like DNS, caches, and so on.
Run the terminal commands below: (run the command one line at a time)
set http_proxy=

set https_proxy=

yarn config delete proxy

npm config rm https-proxy

npm config rm proxy

npm config set registry "https://registry.npmjs.org"
3rd - Restart your terminal and try rerun the "yarn" command with --network-timeout flag
yarn

yarn add mypckge --network-timeout 100000

yarn --network-timeout 100000
Do try each of the commands above but first, just try running "yarn".

Source

If you like our tutorial, do make sure to support us by being our Patreon or buy us some coffee ☕️

)