Home / Snippets / How to Fix Yarn Trouble With Network Connection
How to Fix Yarn Trouble With Network Connection cover

How to Fix Yarn Trouble With Network Connection


2 years ago


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 add mypckge --network-timeout 100000

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


notion avatar

Ahmad Aziz

Week-end developer currently experimenting with web, mobile, and all things programming.






Support Us

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

Post Tutorials

Learn trending tutorials for ReactJs, React Native, VueJS, NextJs, Laravel, Tailwind CSS, and Flutter development.
View Tutorials

Code Components

Collection of Tailwind CSS components for everyone to use. Browse all of the components that's right for your web projects
View Components

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this