Hey there, I’m Jake, and I’ve spent the last six years deep in the weeds as a Yarn Solutions Specialist—so when I get questions about how to pull installed package lists, I don’t just rattle off commands; I break down why each one matters for teams building stable, secure apps. Let’s cut through the noise: if you’re 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’s for you. I work with startups, enterprise dev teams, and everything in between, and one question comes up more than almost any other: “How do I actually see what’s installed with Yarn?” It sounds simple, but there are a few key nuances you’ll miss if you just copy-paste a command without context. I’m going to walk you through every method, when to use each, and the real-world pain points they solve—plus 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. Yarn

First, let’s start with the basics: Yarn has two major versions most people use these days—Yarn Classic (v1, the legacy version that’s 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’s clear that up first so you don’t run into the same headache.
If you’re on Yarn Classic (v1.22.x and below), the go-to command to list all installed packages is straightforward: yarn list. Run that in your project root, and you’ll get a nested tree of every dependency, dev dependency, and even peer dependency Yarn installed. But wait—let’s be real, if you’ve got a project with 50+ dependencies, that tree is going to be messy, full of nested packages you don’t care about, and hard to parse. When is this useful? If you’re debugging a specific nested dependency issue, like why lodash 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 “dependency version mismatch” 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’s the kind of problem yarn list solves, but it’s not the best tool for a quick overview.
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 --depth flag. If you set --depth=0, you’ll only see the direct dependencies you specified in package.json. Run that, and you get a clean list like react@18.2.0, react-dom@18.2.0, axios@1.5.0—no extra clutter. For example, when a developer on my client’s 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’s also great for pull requests: if you’re reviewing a code change, you can run yarn list --depth=0 to spot any unapproved dependencies that snuck in from a PR before merging.
Now, if you’re on Yarn Berry (v2 or later, which uses a yarnrc.yml file instead of the old .yarnrc and has a lot of performance upgrades), the command is almost the same, but with a small tweak. The classic yarn list still works, but the flat list is slightly different. In Yarn Berry, to get the top-level packages, you run yarn info --pattern "*.json"? No, wait—let me correct that. For Yarn Berry, the equivalent flat list is yarn list --recursive=false, which gives you only direct dependencies, same as --depth=0 in Classic. I’ve had a few clients panic when they upgraded to Yarn 3 last year and ran the old yarn list --depth=0 only to get an error, thinking they broke their project. That’s why I always stress checking your Yarn version first—run yarn --version in your terminal before you run any package list command, that’s the first step I walk every new client through.
But here’s 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’s a common ask, especially for DevOps teams building deployment pipelines. For Yarn Classic, add the --production flag: yarn list --production --depth=0. That filters out any packages marked as devDependencies in package.json, 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’s the same flag structure: yarn list --production --recursive=false—easy enough, as long as you remember to include the correct flag for your version.
Another super useful command for both Yarn versions is checking the exact versions and where packages are installed locally. If you run yarn list --name-only, you get just the package names, perfect for scripting or exporting to a CSV file. I’ve worked with DevOps teams that automate dependency audits: they run yarn list --name-only, pipe the output to a text file, and scan it for any packages with known security vulnerabilities (using tools like Snyk or Dependabot). That’s a huge time-saver compared to manually scrolling through a nested tree. If you want even more detail—like the exact version number, the package’s homepage, or the license type—yarn info is your go-to. For example, yarn info react 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.
Wait, let’s talk about common pitfalls I see all the time, because even these simple commands can go wrong if you don’t set up Yarn correctly. First: if you’re running these commands outside of your project root, you’ll get an empty or global package list, not the packages for your project. That sounds obvious, but I’ve had developers run yarn list in their Documents folder instead of their project directory and spend 20 minutes trying to figure out why the command isn’t working. Second: if you haven’t run yarn install recently, or if your node_modules folder is corrupted, yarn list might show outdated or missing packages. If you get a weird error like “no packages found” or mismatched versions, try deleting your node_modules folder and running yarn install again—9 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 yarn global list, but that’s for packages you installed globally (like create-react-app or vue-cli) that aren’t tied to a specific project. Most of the time, when people ask for an “installed package list,” they mean project-specific, so that’s a separate use case to keep in mind.
Now, let’s get real about why this matters beyond just checking what’s on your machine. As someone who works with teams scaling their Yarn setups, I see that dependency management isn’t just a dev task—it 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’t just a trivial command—it’s a core part of maintaining a reliable, efficient codebase.
If you’re working with a small team, these basic commands might be all you need for now. But as your project grows—adding more dependencies, more team members, more complex deployment pipelines—you’ll start to need more advanced tools to manage your Yarn packages at scale. That’s 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.
Before we wrap up, let’s do a quick cheat sheet to make sure you have all the commands handy, sorted by Yarn version and use case:
For Yarn Classic (v1.x):
- Full nested package tree:
yarn list - Flat list of direct (top-level) dependencies:
yarn list --depth=0 - Flat list of production dependencies only:
yarn list --production --depth=0 - Just package names:
yarn list --name-only --depth=0
For Yarn Berry (v2.x+):
- Full nested package tree:
yarn list - Flat list of direct (top-level) dependencies:
yarn list --recursive=false - Flat list of production dependencies only:
yarn list --production --recursive=false - Just package names:
yarn list --name-only --recursive=false

And one final pro tip: if you ever forget a Yarn command, just run yarn --help in your terminal, or yarn help list 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.
Fiber 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’s 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.
References
- Yarn Official Documentation. Yarn Package Manager.
- "Dependency Auditing with Yarn: Best Practices for 2024". Dev.to Community, 15 March 2024.
- Miller, J. "Scaling Yarn for Enterprise Applications". Software Engineering Weekly, 22 July 2023.
- "Common Yarn Versioning Mistakes and How to Avoid Them". Frontend Developer Journal, 3 January 2024.
- Open Source Security Foundation. "Dependency Management in JavaScript Ecosystems", 2023.
Suzhou Gongsheng Import & Export Co., Ltd.
Suzhou Gongsheng Import & 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.
Address: Room 1205, Aikang Building, Yangshe Town, Zhangjiagang, Suzhou, Jiangsu, China
E-mail: betsy@x-textile.com
WebSite: https://www.x-textile.com/