Use this tag for version specific questions about Yarn version 2.x. Yarn is an open-source JavaScript package manager created by Facebook, Exponent, Google, and Tilde. When using this tag also include the more generic [yarnpkg] tag where possible.
Questions tagged [yarnpkg-v2]
192 questions
61
votes
1 answer
Yarn v2 gitignore
I upgraded yarn from v1.22.0 to v2.0.0-rc.29. It generated .yarn folder with:
folders: cache, releases, unplugged
files: build-state.yml
Should I add whole .yarn folder to .gitignore? Or maybe some nested folders in there like .yarn/cache?
Also,…

Alexandr Panteleev
- 715
- 1
- 5
- 9
33
votes
4 answers
Committing .yarn directory to git when using yarn berry
In the next version of yarn ("berry") the manual states that one should just commit the directory created called .yarn, but if you use the multi-version setup for yarn, this directory contains the file releases/yarn-berry.js which seems to be the…

mzedeler
- 4,177
- 4
- 28
- 41
22
votes
2 answers
when running yarn install, what does it mean when a module doesn't provide another?
when i run yarn on my react app that uses firebase, i will get several warnings like...
@firebase/auth@npm:0.14.5 [c52f6] doesn't provide @firebase/app-types@0.x requested by @firebase/auth-types@npm:0.10.0
myapp@workspace:. doesn't provide…

brewster
- 4,342
- 6
- 45
- 67
17
votes
2 answers
Best way to audit dependencies in Yarn 2 (berry)?
I'm looking for a way to audit dependencies for vulnerabilities in Yarn 2. In Yarn 1.x it was possible the same was as in npm, by running yarn audit instead of npm audit. But with Yarn 2 there is no such command. And according to this issue on the…

Julian Suggate
- 627
- 1
- 6
- 14
12
votes
2 answers
yarn - Proper way to quickly check if `package.json` and `yarn.lock` requirements are satisfied?
I'd like to verify whether all the dependencies in my project (package.json and yarn.lock) are satisfied without having to run yarn install (which builds out a whole dependency tree and makes network requests)
At first, I was very hopeful that yarn…

user2490003
- 10,706
- 17
- 79
- 155
11
votes
1 answer
Sharing typescript code between two projects in a monorepo with yarn 2 workspaces
I want to set up a project with a client part (react-app), a server part (express) and a shared library (utils) in typescript. I use yarn 2 workspaces and wanted to avoid using larna (if possible). Unfortunately, I have not been able to make it work…

Thomas Dunkel
- 181
- 1
- 7
10
votes
0 answers
Gets ENOTDIR error when yarn start for expo project
I activated yarn by following yarn official docs (https://yarnpkg.com/getting-started/install)
I created an expo app with yarn by following react native official docs (https://reactnative.dev/docs/environment-setup)
But when I run yarn start I get…

minseokk
- 123
- 3
9
votes
0 answers
yarn 2 (berry) doesn't use .yarnrc.yml from home directory
I would like to use npmAuthToken from .yarnrc.yml which is located in my home directory
~/.yarnrc.yml content
npmScopes:
company:
npmAuthToken: NpmToken.token
~/Project/MyProject/.yarnrc.yml content
enableGlobalCache: true
logFilters:
-…

Georgii Savin
- 111
- 3
9
votes
2 answers
How to associate registry with scope in Yarn 2 without breaking auth?
This article suggests adding configuration to .npmrc in your project to associate a scope with a private registry to reduce the risk of a npm substitution attack (where someone might deliberately publish a malicious public package with the same…

Matt Russell
- 155
- 1
- 2
- 7
8
votes
2 answers
Yarn 3 and Node 17: file extension resolution fails?
After upgrading to Yarn 3.0 with Yarn Plug'n'Play (throw out node_modules), I started having issues with filename resolution when starting Node.
After successfully starting server.js it tries to resolve the first imported file in the project, called…

Michael Johansen
- 4,688
- 5
- 29
- 47
8
votes
2 answers
yarn set version not working. Can't change from yarn 3.0.0 to yarn 2.0.0
current yarn version is yarn 3.0.0.
Tried changing to yarn 2.0.0 using yarn set version 2.0.0-rc.30.
Even after that yarn version still remains at yarn 3.0.0.
Other alternatives I tried:
npm uninstall -g yarn then npm install -g yarn. Still yarn…

BiozterzCodes
- 165
- 1
- 10
8
votes
1 answer
Module not found error using Yarn 2 to link React components
I've created a repository which contains a React app (created with create-react-app) and a components directory which contains a simple Material UI button. The folder structure is:
/components
/react-app
Both directories are set up to use Yarn 2,…

Craig Myles
- 5,206
- 3
- 40
- 37
7
votes
2 answers
Why yarn creates a .pnp.loader.mjs and .pnp.cjs files
I use vite on react, and when i use yarn to "live server" my project two new files are created, .pnp.loader.mjs and .pnp.cjs. What is the purpose of this files?
I never see those files, always use npm or yarn and is the first time that they appear.

Esteban Sabo
- 71
- 1
- 6
7
votes
1 answer
Yarn 2/3 link via resolution for local development breaks staging
Just upgraded from Yarn 1 to Yarn 3.
In my package.json of my "Project 1" I have a dependencies to my published package
dependencies: {
...
"@my-package/name": "3.4"
...
}
With Yarn 1 not altering package.json when linking "Project 1" to…

retrovertigo
- 538
- 9
- 20
7
votes
2 answers
How in Yarn 2 do I share common dependencies in workspaces?
Mostly the same question as this, but for yarn 2. I put my shared dependencies at the top of the hierarchy. I believe I'm not using PnP currently.
.yarnrc.yaml
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-2.2.2.cjs
at the very top level I…

xenoterracide
- 16,274
- 24
- 118
- 243