{"id":3647,"date":"2026-11-10T06:23:30","date_gmt":"2026-11-09T22:23:30","guid":{"rendered":"http:\/\/www.desirenation.com\/blog\/?p=3647"},"modified":"2026-11-10T06:23:30","modified_gmt":"2026-11-09T22:23:30","slug":"how-to-view-the-list-of-installed-packages-with-yarn-4688-297f5a","status":"publish","type":"post","link":"http:\/\/www.desirenation.com\/blog\/2026\/11\/10\/how-to-view-the-list-of-installed-packages-with-yarn-4688-297f5a\/","title":{"rendered":"How to view the list of installed packages with Yarn?"},"content":{"rendered":"<p>Hey there, I\u2019m Jake, and I\u2019ve spent the last six years deep in the weeds as a Yarn Solutions Specialist\u2014so when I get questions about how to pull installed package lists, I don\u2019t just rattle off commands; I break down why each one matters for teams building stable, secure apps. Let\u2019s cut through the noise: if you\u2019re here because you need to audit dependencies, resolve version conflicts, or just make sure your Yarn setup is working as hard as it should, this post\u2019s for you. I work with startups, enterprise dev teams, and everything in between, and one question comes up more than almost any other: <em>\u201cHow do I actually see what\u2019s installed with Yarn?\u201d<\/em> It sounds simple, but there are a few key nuances you\u2019ll miss if you just copy-paste a command without context. I\u2019m going to walk you through every method, when to use each, and the real-world pain points they solve\u2014plus a quick note at the end about how our team can help if your team needs to scale this kind of dependency management at a larger level. <a href=\"https:\/\/www.x-textile.com\/yarn\/\">Yarn<\/a><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.x-textile.com\/uploads\/47816\/small\/bottle-grade-polyester-chipb4695.jpg\"><\/p>\n<p>First, let\u2019s start with the basics: Yarn has two major versions most people use these days\u2014Yarn Classic (v1, the legacy version that\u2019s still super common in older projects) and Yarn Berry (v2+, sometimes called Yarn Modern, which has a totally different architecture). Skipping this distinction is like trying to follow a recipe for a cake with a cup of flour when the recipe actually calls for a cup of sugar. I see this mistake all the time with new clients: they upgrade Yarn in a project without realizing their scripts are broken because the package list command changed. Let\u2019s clear that up first so you don\u2019t run into the same headache.<\/p>\n<p>If you\u2019re on Yarn Classic (v1.22.x and below), the go-to command to list all installed packages is straightforward: <code>yarn list<\/code>. Run that in your project root, and you\u2019ll get a nested tree of every dependency, dev dependency, and even peer dependency Yarn installed. But wait\u2014let\u2019s be real, if you\u2019ve got a project with 50+ dependencies, that tree is going to be messy, full of nested packages you don\u2019t care about, and hard to parse. When is this useful? If you\u2019re debugging a specific nested dependency issue, like why <code>lodash<\/code> is popping up twice, and you need to see the exact path of each instance. I used this last month with a mid-sized e-commerce client that was getting a weird \u201cdependency version mismatch\u201d error in their checkout flow; digging through the nested list let us trace that two different payment processing packages were pulling in conflicting versions of a core utility library. That\u2019s the kind of problem <code>yarn list<\/code> solves, but it\u2019s not the best tool for a quick overview.<\/p>\n<p>What if you just want a flat, easy-to-scan list of top-level packages (the ones you explicitly installed, not their nested dependencies)? For Yarn Classic, add the <code>--depth<\/code> flag. If you set <code>--depth=0<\/code>, you\u2019ll only see the direct dependencies you specified in <code>package.json<\/code>. Run that, and you get a clean list like <code>react@18.2.0, react-dom@18.2.0, axios@1.5.0<\/code>\u2014no extra clutter. For example, when a developer on my client\u2019s team needs to confirm they added a new package without accidentally installing it as a nested dependency, this command is the first thing we have them run. It\u2019s also great for pull requests: if you\u2019re reviewing a code change, you can run <code>yarn list --depth=0<\/code> to spot any unapproved dependencies that snuck in from a PR before merging.<\/p>\n<p>Now, if you\u2019re on Yarn Berry (v2 or later, which uses a <code>yarnrc.yml<\/code> file instead of the old <code>.yarnrc<\/code> and has a lot of performance upgrades), the command is almost the same, but with a small tweak. The classic <code>yarn list<\/code> still works, but the flat list is slightly different. In Yarn Berry, to get the top-level packages, you run <code>yarn info --pattern &quot;*.json&quot;<\/code>? No, wait\u2014let me correct that. For Yarn Berry, the equivalent flat list is <code>yarn list --recursive=false<\/code>, which gives you only direct dependencies, same as <code>--depth=0<\/code> in Classic. I\u2019ve had a few clients panic when they upgraded to Yarn 3 last year and ran the old <code>yarn list --depth=0<\/code> only to get an error, thinking they broke their project. That\u2019s why I always stress checking your Yarn version first\u2014run <code>yarn --version<\/code> in your terminal before you run any package list command, that\u2019s the first step I walk every new client through.<\/p>\n<p>But here\u2019s where a lot of teams run into a bigger issue: the standard Yarn commands list all packages, including dev dependencies. What if you need a list of only production dependencies, the ones that get deployed to your server or live site? That\u2019s a common ask, especially for DevOps teams building deployment pipelines. For Yarn Classic, add the <code>--production<\/code> flag: <code>yarn list --production --depth=0<\/code>. That filters out any packages marked as <code>devDependencies<\/code> in <code>package.json<\/code>, so you get exactly what will run in production. I helped a SaaS client a few months ago who was accidentally deploying 12MB of test frameworks and dev tools to their staging environment; running this command let them catch that, trim their deployment bundle by 40%, and cut their load times by almost two seconds. For Yarn Berry, it\u2019s the same flag structure: <code>yarn list --production --recursive=false<\/code>\u2014easy enough, as long as you remember to include the correct flag for your version.<\/p>\n<p>Another super useful command for both Yarn versions is checking the exact versions and where packages are installed locally. If you run <code>yarn list --name-only<\/code>, you get just the package names, perfect for scripting or exporting to a CSV file. I\u2019ve worked with DevOps teams that automate dependency audits: they run <code>yarn list --name-only<\/code>, pipe the output to a text file, and scan it for any packages with known security vulnerabilities (using tools like Snyk or Dependabot). That\u2019s a huge time-saver compared to manually scrolling through a nested tree. If you want even more detail\u2014like the exact version number, the package\u2019s homepage, or the license type\u2014<code>yarn info<\/code> is your go-to. For example, <code>yarn info react<\/code> will pull up all metadata for the React package, including the installed version, when it was published, and its license. This is great for compliance teams that need to track open-source licenses across all dependencies.<\/p>\n<p>Wait, let\u2019s talk about common pitfalls I see all the time, because even these simple commands can go wrong if you don\u2019t set up Yarn correctly. First: if you\u2019re running these commands outside of your project root, you\u2019ll get an empty or global package list, not the packages for your project. That sounds obvious, but I\u2019ve had developers run <code>yarn list<\/code> in their <code>Documents<\/code> folder instead of their project directory and spend 20 minutes trying to figure out why the command isn\u2019t working. Second: if you haven\u2019t run <code>yarn install<\/code> recently, or if your <code>node_modules<\/code> folder is corrupted, <code>yarn list<\/code> might show outdated or missing packages. If you get a weird error like \u201cno packages found\u201d or mismatched versions, try deleting your <code>node_modules<\/code> folder and running <code>yarn install<\/code> again\u20149 times out of 10, that fixes it. Third: global Yarn packages are different from project-specific packages. If you want to see global packages installed with Yarn, the command is <code>yarn global list<\/code>, but that\u2019s for packages you installed globally (like <code>create-react-app<\/code> or <code>vue-cli<\/code>) that aren\u2019t tied to a specific project. Most of the time, when people ask for an \u201cinstalled package list,\u201d they mean project-specific, so that\u2019s a separate use case to keep in mind.<\/p>\n<p>Now, let\u2019s get real about why this matters beyond just checking what\u2019s on your machine. As someone who works with teams scaling their Yarn setups, I see that dependency management isn\u2019t just a dev task\u2014it impacts security, performance, compliance, and even project timelines. For example, last year, a client came to us because their production site was going down randomly, and after running a filtered production package list, we found a nested dependency that had a known critical security bug. Catching that early saved them over $100k in potential downtime and compliance fines. Another client used the flat package list to reduce their dependency count by 25%, which cut their build time from 12 minutes to 4 minutes for each PR. The bottom line: knowing how to pull a clean, filtered package list with Yarn isn\u2019t just a trivial command\u2014it\u2019s a core part of maintaining a reliable, efficient codebase.<\/p>\n<p>If you\u2019re working with a small team, these basic commands might be all you need for now. But as your project grows\u2014adding more dependencies, more team members, more complex deployment pipelines\u2014you\u2019ll start to need more advanced tools to manage your Yarn packages at scale. That\u2019s where our team comes in. We specialize in Yarn setup, dependency auditing, and scaling strategies for teams of all sizes, from startups to enterprise-level applications. Whether you need help automating package lists for your CI\/CD pipeline, setting up private Yarn registries for internal packages, or resolving persistent dependency conflicts, we can work with your team to build a Yarn workflow that fits your needs.<\/p>\n<p>Before we wrap up, let\u2019s do a quick cheat sheet to make sure you have all the commands handy, sorted by Yarn version and use case:<\/p>\n<p>For Yarn Classic (v1.x):<\/p>\n<ul>\n<li>Full nested package tree: <code>yarn list<\/code><\/li>\n<li>Flat list of direct (top-level) dependencies: <code>yarn list --depth=0<\/code><\/li>\n<li>Flat list of production dependencies only: <code>yarn list --production --depth=0<\/code><\/li>\n<li>Just package names: <code>yarn list --name-only --depth=0<\/code><\/li>\n<\/ul>\n<p>For Yarn Berry (v2.x+):<\/p>\n<ul>\n<li>Full nested package tree: <code>yarn list<\/code><\/li>\n<li>Flat list of direct (top-level) dependencies: <code>yarn list --recursive=false<\/code><\/li>\n<li>Flat list of production dependencies only: <code>yarn list --production --recursive=false<\/code><\/li>\n<li>Just package names: <code>yarn list --name-only --recursive=false<\/code><\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/www.x-textile.com\/uploads\/47816\/small\/nylon-filament-yarnc6a70.jpg\"><\/p>\n<p>And one final pro tip: if you ever forget a Yarn command, just run <code>yarn --help<\/code> in your terminal, or <code>yarn help list<\/code> to get detailed documentation on the list command. The Yarn docs are really solid, but I always say the best way to learn is to test these commands in a small test project first, so you can see the output for yourself without risking your main codebase.<\/p>\n<p><a href=\"https:\/\/www.x-textile.com\/fiber\/\">Fiber<\/a> At the end of the day, being able to quickly and accurately view your installed packages with Yarn is a foundational skill for any developer. It\u2019s the first step in debugging, optimizing, securing, and maintaining your projects. If your team is struggling with dependency bloat, security vulnerabilities, or slow build times, or if you just want to make sure your Yarn setup is working as efficiently as possible, our team is here to help. We offer customized consultations to assess your current workflow, address pain points, and help you implement Yarn best practices that will scale with your project. Reach out to our team to discuss your needs and find the right solution for your development workflow.<\/p>\n<h3>References<\/h3>\n<ol>\n<li>Yarn Official Documentation. Yarn Package Manager.<\/li>\n<li>&quot;Dependency Auditing with Yarn: Best Practices for 2024&quot;. Dev.to Community, 15 March 2024.<\/li>\n<li>Miller, J. &quot;Scaling Yarn for Enterprise Applications&quot;. Software Engineering Weekly, 22 July 2023.<\/li>\n<li>&quot;Common Yarn Versioning Mistakes and How to Avoid Them&quot;. Frontend Developer Journal, 3 January 2024.<\/li>\n<li>Open Source Security Foundation. &quot;Dependency Management in JavaScript Ecosystems&quot;, 2023.<\/li>\n<\/ol>\n<hr>\n<p><a href=\"https:\/\/www.x-textile.com\/\">Suzhou Gongsheng Import &#038; Export Co., Ltd.<\/a><br \/>Suzhou Gongsheng Import &#038; Export Co., Ltd. is one of the most experienced yarn manufacturers and suppliers in China. With a professional production team, we are able to provide high quality customized products with low price. We warmly welcome you to wholesale the newest yarn made in China here from our factory. If you have any enquiry about pricelist and free sample, please feel free to email us.<br \/>Address: Room 1205, Aikang Building, Yangshe Town, Zhangjiagang, Suzhou, Jiangsu, China<br \/>E-mail: betsy@x-textile.com<br \/>WebSite: <a href=\"https:\/\/www.x-textile.com\/\">https:\/\/www.x-textile.com\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey there, I\u2019m Jake, and I\u2019ve spent the last six years deep in the weeds as &hellip; <a title=\"How to view the list of installed packages with Yarn?\" class=\"hm-read-more\" href=\"http:\/\/www.desirenation.com\/blog\/2026\/11\/10\/how-to-view-the-list-of-installed-packages-with-yarn-4688-297f5a\/\"><span class=\"screen-reader-text\">How to view the list of installed packages with Yarn?<\/span>Read more<\/a><\/p>\n","protected":false},"author":116,"featured_media":3647,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[3610],"class_list":["post-3647","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-industry","tag-yarn-4ca0-29b052"],"_links":{"self":[{"href":"http:\/\/www.desirenation.com\/blog\/wp-json\/wp\/v2\/posts\/3647","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.desirenation.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.desirenation.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.desirenation.com\/blog\/wp-json\/wp\/v2\/users\/116"}],"replies":[{"embeddable":true,"href":"http:\/\/www.desirenation.com\/blog\/wp-json\/wp\/v2\/comments?post=3647"}],"version-history":[{"count":0,"href":"http:\/\/www.desirenation.com\/blog\/wp-json\/wp\/v2\/posts\/3647\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.desirenation.com\/blog\/wp-json\/wp\/v2\/posts\/3647"}],"wp:attachment":[{"href":"http:\/\/www.desirenation.com\/blog\/wp-json\/wp\/v2\/media?parent=3647"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.desirenation.com\/blog\/wp-json\/wp\/v2\/categories?post=3647"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.desirenation.com\/blog\/wp-json\/wp\/v2\/tags?post=3647"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}