{"id":7708,"date":"2024-02-02T08:03:34","date_gmt":"2024-02-02T08:03:34","guid":{"rendered":"https:\/\/www.webhi.com\/how-to\/?p=7708"},"modified":"2024-02-02T08:04:56","modified_gmt":"2024-02-02T08:04:56","slug":"how-to-install-yarn-ubuntu-linux","status":"publish","type":"post","link":"https:\/\/www.webhi.com\/how-to\/how-to-install-yarn-ubuntu-linux\/","title":{"rendered":"How to install Yarn on Ubuntu"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/02\/yarn_ubuntu_en.jpg\" alt=\"Installing Yarn on Ubuntu 18.04 20.04 22.04 Debian linux Step-by-Step Guide\" class=\"wp-image-7719\" srcset=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/02\/yarn_ubuntu_en.jpg 1200w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/02\/yarn_ubuntu_en-300x169.jpg 300w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/02\/yarn_ubuntu_en-1024x576.jpg 1024w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/02\/yarn_ubuntu_en-768x432.jpg 768w, https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/02\/yarn_ubuntu_en-150x84.jpg 150w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" \/><\/figure>\n\n\n\n<p><strong>Yarn<\/strong> is a popular JavaScript package manager that allows you to easily install and manage JavaScript packages and dependencies for your projects. In this comprehensive guide, I will walk you through the complete process of installing Yarn on Ubuntu. I will cover installing Yarn through both the APT package manager and direct downloads, troubleshooting any issues, as well as best practices for keeping Yarn up-to-date.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"introduction-to-yarn\">Introduction to Yarn<\/h2>\n\n\n\n<p>Yarn was created by Facebook in 2016 as an alternative to the npm package manager for Node.js. It aims to provide increased performance and reliability over npm. Some of the key features and benefits of Yarn include:<\/p>\n\n\n\n<ul>\n<li>Faster and more reliable installations &#8211; Yarn caches every package it downloads so it never needs to download the same package again. This significantly improves install times. It also utilizes parallelism to maximize resource utilization during installs.<\/li>\n\n\n\n<li>Offline mode &#8211; If you&#8217;ve installed a package before, Yarn will use the cached version allowing you to continue working offline.<\/li>\n\n\n\n<li>Consistent installs &#8211; Yarn uses lockfiles and a deterministic algorithm to ensure that an install results in the same file structure across all machines.<\/li>\n\n\n\n<li>Secure &#8211; Yarn installs packages securely by default with HTTPS and cryptographic verification.<\/li>\n\n\n\n<li>Compatible with npm &#8211; Yarn still utilizes the same package.json structure as npm and can work seamlessly with npm installed packages. Most npm commands will still work with Yarn.<\/li>\n<\/ul>\n\n\n\n<p>Yarn provides a performant, reliable and secure package manager for JavaScript projects. It is a great choice for managing dependencies when building Node.js applications.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"prerequisites\">Prerequisites<\/h2>\n\n\n\n<p>Before installing Yarn, you will need:<\/p>\n\n\n\n<ul>\n<li>Ubuntu 18.04 or higher. These instructions should work on any recent release.<\/li>\n\n\n\n<li>Non-root user account with sudo privileges.<\/li>\n\n\n\n<li>Node.js 10 or higher.<\/li>\n\n\n\n<li>npm installed. This usually comes preinstalled with Node.js.<\/li>\n<\/ul>\n\n\n\n<p>You can verify these prerequisites by running:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ lsb_release -a<\/code><\/pre>\n\n\n\n<p>This will display your Ubuntu version.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ node -v<\/code><\/pre>\n\n\n\n<p>To check your Node.js version.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ npm -v<\/code><\/pre>\n\n\n\n<p>For your npm version.<\/p>\n\n\n\n<p>If you need to install or upgrade Node.js and npm, the easiest way is to use the NodeSource package archives. You can install the latest Node.js LTS release with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ curl -sL https:\/\/deb.nodesource.com\/setup_lts.x | sudo -E bash -\n$ sudo apt install -y nodejs<\/code><\/pre>\n\n\n\n<p>With the prerequisites met, we can now install Yarn.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"installing-yarn-via-apt\">Installing Yarn via APT<\/h2>\n\n\n\n<p>The recommended way to install Yarn on Ubuntu is by using the APT package manager. Yarn is included in the default Ubuntu repositories starting in Ubuntu 18.04.<\/p>\n\n\n\n<p>To install Yarn:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo apt update\n$ sudo apt install yarn<\/code><\/pre>\n\n\n\n<p>This will install the latest stable release of Yarn from the package repositories.<\/p>\n\n\n\n<p>Verify it installed correctly:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ yarn --version<\/code><\/pre>\n\n\n\n<p>If it displays the version number, Yarn has been successfully installed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"using-direct-downloads\">Using Direct Downloads<\/h2>\n\n\n\n<p>Yarn can also be installed via direct downloads from their official website. This allows you to install specific version releases.<\/p>\n\n\n\n<p>First, download the .deb package for your Ubuntu version:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ curl -sS https:\/\/dl.yarnpkg.com\/debian\/pubkey.gpg | sudo apt-key add -\n$ echo \"deb https:\/\/dl.yarnpkg.com\/debian\/ stable main\" | sudo tee \/etc\/apt\/sources.list.d\/yarn.list\n\n$ sudo apt update\n$ sudo apt install yarn<\/code><\/pre>\n\n\n\n<p>Or for a specific version:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ curl -sS https:\/\/dl.yarnpkg.com\/debian\/pubkey.gpg | sudo apt-key add -\n$ echo \"deb https:\/\/dl.yarnpkg.com\/debian\/ stable main\" | sudo tee \/etc\/apt\/sources.list.d\/yarn.list\n\n$ sudo apt update\n$ sudo apt install yarn=1.22.19-1<\/code><\/pre>\n\n\n\n<p>This will allow you to install a particular Yarn release like 1.22.19 rather than just the latest.<\/p>\n\n\n\n<p>Check it installed correctly:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ yarn --version<\/code><\/pre>\n\n\n\n<p>The direct downloads give you more control over the version you install.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"global-vs-local-installations\">Global vs Local Installations<\/h2>\n\n\n\n<p>By default, Yarn is installed globally on the system. This allows you to run the&nbsp;<code>yarn<\/code>&nbsp;command anywhere to manage JavaScript packages.<\/p>\n\n\n\n<p>Yarn can also be installed locally within specific project directories. This allows you to use different Yarn versions for different projects.<\/p>\n\n\n\n<p>To install Yarn locally, run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ npm install --global yarn<\/code><\/pre>\n\n\n\n<p>Within a project directory. Now only this project will have access to the yarn command.<\/p>\n\n\n\n<p>The global installation is more convenient and recommended for most scenarios. But a local install gives you more control for individual projects.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"setting-the-yarn-cache-directory\">Setting the Yarn Cache Directory<\/h2>\n\n\n\n<p>By default, Yarn stores its package cache globally in&nbsp;<code>~\/.cache\/yarn<\/code>. This can gradually consume disk space over time as more packages are installed.<\/p>\n\n\n\n<p>If you want to change the cache location, you can use the&nbsp;<code>yarn config<\/code>&nbsp;command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ yarn config set cache-folder \/new\/cache\/folder<\/code><\/pre>\n\n\n\n<p>This will move the cache to a new directory like&nbsp;<code>\/opt\/yarn\/cache<\/code>&nbsp;or to another partition with more storage space.<\/p>\n\n\n\n<p>You can verify the new cache folder by checking the config:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ yarn config get cache-folder<\/code><\/pre>\n\n\n\n<p>Setting a custom cache directory can help manage disk space usage.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"basic-yarn-commands\">Basic Yarn Commands<\/h2>\n\n\n\n<p>Now that Yarn is installed, you can begin using it to manage JavaScript packages. Some common commands include:<\/p>\n\n\n\n<ul>\n<li><code>yarn init<\/code>&nbsp;&#8211; Initializes a new project including the package.json file.<\/li>\n\n\n\n<li><code>yarn install<\/code>&nbsp;&#8211; Installs all dependencies for a project based on package.json.<\/li>\n\n\n\n<li><code>yarn add [package]<\/code>&nbsp;&#8211; Adds a new package to use in the project.<\/li>\n\n\n\n<li><code>yarn remove [package]<\/code>&nbsp;&#8211; Removes an existing package from the project.<\/li>\n\n\n\n<li><code>yarn upgrade [package]<\/code>&nbsp;&#8211; Upgrades an installed package to the latest version.<\/li>\n\n\n\n<li><code>yarn why [package]<\/code>&nbsp;&#8211; Shows why a package is installed and which other package depends on it.<\/li>\n\n\n\n<li><code>yarn run<\/code>&nbsp;&#8211; Runs a defined script from package.json.<\/li>\n<\/ul>\n\n\n\n<p>To begin using Yarn for a new project:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ yarn init\n$ yarn install<\/code><\/pre>\n\n\n\n<p>This will initialize the project and install the current dependencies. Then you can begin adding additional packages as needed.<\/p>\n\n\n\n<p>Refer to the&nbsp;<a href=\"https:\/\/yarnpkg.com\/cli\/\">Yarn CLI documentation<\/a>&nbsp;for more usage details.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"upgrading-yarn\">Upgrading Yarn<\/h2>\n\n\n\n<p>As new versions of Yarn are released, you may want to upgrade to the latest for bug fixes and new features.<\/p>\n\n\n\n<p>If you installed Yarn using APT, run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo apt update\n$ sudo apt install yarn<\/code><\/pre>\n\n\n\n<p>This will upgrade Yarn to the latest version in the repositories.<\/p>\n\n\n\n<p>For direct downloads, reinstall the new version .deb package:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">$ sudo apt install yarn=NEW_VERSION_HERE <\/code><\/pre>\n\n\n\n<p>You can find the latest version on the&nbsp;<a href=\"https:\/\/yarnpkg.com\/getting-started\/install\">Yarn website<\/a>.<\/p>\n\n\n\n<p>Upgrading Yarn will ensure you have the latest bug fixes and features. Check the&nbsp;<a href=\"https:\/\/github.com\/yarnpkg\/yarn\/releases\">release notes<\/a>&nbsp;when upgrading.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"troubleshooting-issues\">Troubleshooting Issues<\/h2>\n\n\n\n<p>Here are some common problems and solutions when installing Yarn:<\/p>\n\n\n\n<p><strong>Command not found<\/strong>&nbsp;&#8211; If&nbsp;<code>yarn<\/code>&nbsp;command returns &#8220;command not found&#8221;, ensure Yarn is installed and&nbsp;<code>~\/.npm-global\/bin<\/code>&nbsp;is in your PATH env variable.<\/p>\n\n\n\n<p><strong>Permissions errors<\/strong>&nbsp;&#8211; Use&nbsp;<code>sudo<\/code>&nbsp;when globally installing Yarn. Don&#8217;t run the&nbsp;<code>yarn<\/code>&nbsp;command with sudo.<\/p>\n\n\n\n<p><strong>Old Node.js version<\/strong>&nbsp;&#8211; Make sure you have Node.js 10+ installed. Lower versions may not be compatible.<\/p>\n\n\n\n<p><strong>Package installation fails<\/strong>&nbsp;&#8211; Check the network and any proxies. Try manually installing the package with&nbsp;<code>npm<\/code>&nbsp;instead.<\/p>\n\n\n\n<p><strong>Can&#8217;t upgrade Yarn<\/strong>&nbsp;&#8211; Your current Yarn version may be too old to upgrade directly. Try removing&nbsp;<code>.yarnclean<\/code>&nbsp;and&nbsp;<code>~\/.cache\/yarn<\/code>&nbsp;then reinstalling.<\/p>\n\n\n\n<p>For any other issues, refer to the Yarn&nbsp;<a href=\"https:\/\/yarnpkg.com\/corepack#troubleshooting\">troubleshooting guide<\/a>. The Yarn community forums are also a good place to find solutions.<\/p>\n\n\n\n<p>With the basics covered in this guide you should be able to successfully install, configure and use Yarn for your JavaScript projects on Ubuntu.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h2>\n\n\n\n<p>Yarn is a valuable tool for front-end developers to efficiently manage JavaScript dependencies and packages. Learning how to properly install, configure and upgrade Yarn helps ensure you leverage its full capabilities.<\/p>\n\n\n\n<p><strong>Key points covered in this guide:<\/strong><\/p>\n\n\n\n<ul>\n<li>Installing Yarn via APT and direct downloads on Ubuntu<\/li>\n\n\n\n<li>Global vs local installations for managing versions<\/li>\n\n\n\n<li>Setting a custom cache directory location<\/li>\n\n\n\n<li>Basic Yarn commands for daily usage<\/li>\n\n\n\n<li>Upgrading Yarn to the latest versions<\/li>\n\n\n\n<li>Troubleshooting common problems<\/li>\n\n\n\n<li>Following best practices for stability and performance<\/li>\n<\/ul>\n\n\n\n<p>With Yarn properly set up, you can take advantage of:<\/p>\n\n\n\n<ul>\n<li>Faster, more reliable installations<\/li>\n\n\n\n<li>Offline mode<\/li>\n\n\n\n<li>Improved security<\/li>\n<\/ul>\n\n\n\n<p>Combined with knowledge of the Yarn CLI and best practices, you can optimize your JavaScript workflow.<\/p>\n\n\n\n<p>Yarn simplifies dependency management for building Node.js applications on Ubuntu. Following this tutorial will get you up and running with this useful tool.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yarn is a popular JavaScript package manager that allows you to easily install and manage JavaScript packages and dependencies for your projects. In this comprehensive guide, I will walk you through the complete process of installing Yarn on Ubuntu. I will cover installing Yarn through both the APT package manager and direct downloads, troubleshooting any ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/www.webhi.com\/how-to\/how-to-install-yarn-ubuntu-linux\/\" title=\"read more...\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[188,69],"tags":[],"yoast_head":"\n<title>How to install Yarn on Ubuntu - WebHi Tutorials &amp; Documentations<\/title>\n<meta name=\"description\" content=\"Learn how to install and configure Yarn on Ubuntu for fast, reliable JavaScript dependency management. This comprehensive guide covers installing Yarn via APT and direct downloads, basic commands, upgrading, troubleshooting, and best practices.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.webhi.com\/how-to\/how-to-install-yarn-ubuntu-linux\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to install Yarn on Ubuntu - WebHi Tutorials &amp; Documentations\" \/>\n<meta property=\"og:description\" content=\"Learn how to install and configure Yarn on Ubuntu for fast, reliable JavaScript dependency management. This comprehensive guide covers installing Yarn via APT and direct downloads, basic commands, upgrading, troubleshooting, and best practices.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.webhi.com\/how-to\/how-to-install-yarn-ubuntu-linux\/\" \/>\n<meta property=\"og:site_name\" content=\"WebHi Tutorials &amp; Documentations\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webhi.technology\" \/>\n<meta property=\"article:published_time\" content=\"2024-02-02T08:03:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-02-02T08:04:56+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/02\/yarn_ubuntu_en.jpg\" \/>\n<meta name=\"author\" content=\"webhi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@WebHiTechnology\" \/>\n<meta name=\"twitter:site\" content=\"@WebHiTechnology\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"webhi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"TechArticle\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/how-to-install-yarn-ubuntu-linux\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/how-to-install-yarn-ubuntu-linux\/\"},\"author\":{\"name\":\"webhi\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54\"},\"headline\":\"How to install Yarn on Ubuntu\",\"datePublished\":\"2024-02-02T08:03:34+00:00\",\"dateModified\":\"2024-02-02T08:04:56+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/how-to-install-yarn-ubuntu-linux\/\"},\"wordCount\":1192,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\"},\"articleSection\":[\"CMS &amp; Web development\",\"Linux system administration\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.webhi.com\/how-to\/how-to-install-yarn-ubuntu-linux\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/how-to-install-yarn-ubuntu-linux\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/how-to-install-yarn-ubuntu-linux\/\",\"name\":\"How to install Yarn on Ubuntu - WebHi Tutorials &amp; Documentations\",\"isPartOf\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#website\"},\"datePublished\":\"2024-02-02T08:03:34+00:00\",\"dateModified\":\"2024-02-02T08:04:56+00:00\",\"description\":\"Learn how to install and configure Yarn on Ubuntu for fast, reliable JavaScript dependency management. This comprehensive guide covers installing Yarn via APT and direct downloads, basic commands, upgrading, troubleshooting, and best practices.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/how-to-install-yarn-ubuntu-linux\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.webhi.com\/how-to\/how-to-install-yarn-ubuntu-linux\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/how-to-install-yarn-ubuntu-linux\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.webhi.com\/how-to\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to install Yarn on Ubuntu\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#website\",\"url\":\"https:\/\/www.webhi.com\/how-to\/\",\"name\":\"WebHi Tutorials &amp; Documentations\",\"description\":\"System administration and knowledge base\",\"publisher\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.webhi.com\/how-to\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#organization\",\"name\":\"WebHi Technology\",\"url\":\"https:\/\/www.webhi.com\/how-to\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png\",\"contentUrl\":\"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png\",\"width\":288,\"height\":95,\"caption\":\"WebHi Technology\"},\"image\":{\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webhi.technology\",\"https:\/\/twitter.com\/WebHiTechnology\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54\",\"name\":\"webhi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1783029557\",\"contentUrl\":\"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1783029557\",\"caption\":\"webhi\"},\"sameAs\":[\"https:\/\/www.webhi.com\/how-to\"],\"url\":\"https:\/\/www.webhi.com\/how-to\/author\/webhi\/\"}]}<\/script>\n","yoast_head_json":{"title":"How to install Yarn on Ubuntu - WebHi Tutorials &amp; Documentations","description":"Learn how to install and configure Yarn on Ubuntu for fast, reliable JavaScript dependency management. This comprehensive guide covers installing Yarn via APT and direct downloads, basic commands, upgrading, troubleshooting, and best practices.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.webhi.com\/how-to\/how-to-install-yarn-ubuntu-linux\/","og_locale":"en_US","og_type":"article","og_title":"How to install Yarn on Ubuntu - WebHi Tutorials &amp; Documentations","og_description":"Learn how to install and configure Yarn on Ubuntu for fast, reliable JavaScript dependency management. This comprehensive guide covers installing Yarn via APT and direct downloads, basic commands, upgrading, troubleshooting, and best practices.","og_url":"https:\/\/www.webhi.com\/how-to\/how-to-install-yarn-ubuntu-linux\/","og_site_name":"WebHi Tutorials &amp; Documentations","article_publisher":"https:\/\/www.facebook.com\/webhi.technology","article_published_time":"2024-02-02T08:03:34+00:00","article_modified_time":"2024-02-02T08:04:56+00:00","og_image":[{"url":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2024\/02\/yarn_ubuntu_en.jpg"}],"author":"webhi","twitter_card":"summary_large_image","twitter_creator":"@WebHiTechnology","twitter_site":"@WebHiTechnology","twitter_misc":{"Written by":"webhi","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"TechArticle","@id":"https:\/\/www.webhi.com\/how-to\/how-to-install-yarn-ubuntu-linux\/#article","isPartOf":{"@id":"https:\/\/www.webhi.com\/how-to\/how-to-install-yarn-ubuntu-linux\/"},"author":{"name":"webhi","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54"},"headline":"How to install Yarn on Ubuntu","datePublished":"2024-02-02T08:03:34+00:00","dateModified":"2024-02-02T08:04:56+00:00","mainEntityOfPage":{"@id":"https:\/\/www.webhi.com\/how-to\/how-to-install-yarn-ubuntu-linux\/"},"wordCount":1192,"commentCount":0,"publisher":{"@id":"https:\/\/www.webhi.com\/how-to\/#organization"},"articleSection":["CMS &amp; Web development","Linux system administration"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.webhi.com\/how-to\/how-to-install-yarn-ubuntu-linux\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.webhi.com\/how-to\/how-to-install-yarn-ubuntu-linux\/","url":"https:\/\/www.webhi.com\/how-to\/how-to-install-yarn-ubuntu-linux\/","name":"How to install Yarn on Ubuntu - WebHi Tutorials &amp; Documentations","isPartOf":{"@id":"https:\/\/www.webhi.com\/how-to\/#website"},"datePublished":"2024-02-02T08:03:34+00:00","dateModified":"2024-02-02T08:04:56+00:00","description":"Learn how to install and configure Yarn on Ubuntu for fast, reliable JavaScript dependency management. This comprehensive guide covers installing Yarn via APT and direct downloads, basic commands, upgrading, troubleshooting, and best practices.","breadcrumb":{"@id":"https:\/\/www.webhi.com\/how-to\/how-to-install-yarn-ubuntu-linux\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.webhi.com\/how-to\/how-to-install-yarn-ubuntu-linux\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.webhi.com\/how-to\/how-to-install-yarn-ubuntu-linux\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.webhi.com\/how-to\/"},{"@type":"ListItem","position":2,"name":"How to install Yarn on Ubuntu"}]},{"@type":"WebSite","@id":"https:\/\/www.webhi.com\/how-to\/#website","url":"https:\/\/www.webhi.com\/how-to\/","name":"WebHi Tutorials &amp; Documentations","description":"System administration and knowledge base","publisher":{"@id":"https:\/\/www.webhi.com\/how-to\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.webhi.com\/how-to\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.webhi.com\/how-to\/#organization","name":"WebHi Technology","url":"https:\/\/www.webhi.com\/how-to\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/","url":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png","contentUrl":"https:\/\/www.webhi.com\/how-to\/gilrogre\/2022\/07\/logo.png","width":288,"height":95,"caption":"WebHi Technology"},"image":{"@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webhi.technology","https:\/\/twitter.com\/WebHiTechnology"]},{"@type":"Person","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/b31e76e2311cdc0bb90f5e2733059a54","name":"webhi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.webhi.com\/how-to\/#\/schema\/person\/image\/","url":"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1783029557","contentUrl":"https:\/\/www.webhi.com\/how-to\/ahuphiph\/litespeed\/avatar\/e20da107d0f4c765ead2eef88ad019d8.jpg?ver=1783029557","caption":"webhi"},"sameAs":["https:\/\/www.webhi.com\/how-to"],"url":"https:\/\/www.webhi.com\/how-to\/author\/webhi\/"}]}},"_links":{"self":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/7708"}],"collection":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/comments?post=7708"}],"version-history":[{"count":5,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/7708\/revisions"}],"predecessor-version":[{"id":7729,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/posts\/7708\/revisions\/7729"}],"wp:attachment":[{"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/media?parent=7708"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/categories?post=7708"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webhi.com\/how-to\/wp-json\/wp\/v2\/tags?post=7708"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}