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
3
votes
3 answers
Yarn 3 - How to point installer to correct registry
In my current project which uses NPM Enterprise (i.e. has an internal npm registry), I'm following the steps to migrate from Yarn Classic to Modern. Step 7 says to run yarn install. In doing so, the install fails because it's looking for a library…

Mike S.
- 2,048
- 1
- 32
- 55
3
votes
2 answers
Typescript compiler can't find node with yarn - Cannot find type definition file for 'node'
I have @types/node installed. I'm using Yarn 2 (PnP). Seems like Typescript can't find the @types/node package?
Running yarn build with the build script being webpack shows errors about cannot resolving modules (path, buffer etc)
Running tsc shows…

David Min
- 1,246
- 8
- 27
3
votes
1 answer
Heroku not using cache for Yarn v3
Trying to get Heroku to use cached modules for Yarn v3 using workspaces. I have the following:
package.json:
"engines": {
"node": "16.x",
"yarn": "3.x"
},
"cacheDirectories": [
"node_modules",
"packages/components/node_modules",
…

orbiteleven
- 951
- 1
- 11
- 21
3
votes
1 answer
CLI bump version number with yarn berry
I recently upgraded yarn to yarn berry (v2) and I can't find any equivalent of yarn version --patch. The documentation about differences related to cli commands do not mention yarn version.
Is there a way to bump a package version number using yarn…

mbesson
- 629
- 5
- 24
2
votes
2 answers
Can not find module when adding repo with yarn as package manager
I'm having trouble adding a github repository to my Yarn monorepo. The repo I want to add has TS compiled code for commonjs an es module in dist folder.
I've added the repo, which I want to consume, to the package.json in this format:
…

Zantinger
- 167
- 3
- 16
2
votes
0 answers
if I use yarn Error: Segmentation fault: 11
Until just now, yarn ran well, but suddenly a strange error started to appear.
If i use this command,
yarn run dev
Bus error: 10
yarn -v
Segmentation fault: 11
enter image description here
I tried reinstalling yarn and reinstalling the brew, but the…

Jikwan
- 21
- 2
2
votes
1 answer
Issue while installing YARN
I am trying to install YARN through npm. but I am getting errors.
By running
npm install --global yarn
I see the following:
% npm install --global yarn …

Tripur Joshi
- 21
- 2
2
votes
0 answers
Deploying to firebase functions using yarn as package manage manager
I am working on speeding up my firebase functions deployment and noticed that firebase functions use cloud build to download and install the dependencies from package.json serverside again and was missing a package-lock.json, so had to calculate all…

Paul Weber
- 6,518
- 3
- 43
- 52
2
votes
1 answer
How can I prevent Yarn from installing duplicate copies of identical packages
Using Yarn 3 aka Berry.
I'm having trouble with Yarn wanting to install multiple copies (not versions) of packages. That's trouble for me because these packages have stateful modules, so they might be initialized with some state in one copy of the…

Colin Harrison
- 21
- 2
2
votes
2 answers
How to install only production dependencies in modern yarn when using node-modules linker
I'm using modern Yarn (v3.2.4 to be exact) which differs from Yarn Classic.
I'm using the nodeLinker: node-modules option in .yarnrc.yml so /node_modules are created, and dependencies are not saved to the repo.
I want to install only production…

James
- 615
- 1
- 4
- 22
2
votes
0 answers
Yarn install with yarn.lock failed with `403 Forbidden`
Our project depends on package A which depends on package B. Both A and B exists in a private registry.
Installing package A will update yarn.lock. With the updated yarn.lock, yarn install will fail with error
Package B Request failed \"403…

Hang Yin
- 21
- 2
2
votes
1 answer
Why is my Docker Image so large for AstroJS app?
I'm working on a webpage built with Astrojs. I'm fairly newbie as a frontend developer, and definitely not a full expert in Docker, but my current working folder is 270MB in size, dependencies included, yet when i build the docker image it gets to…

RabidTunes
- 775
- 1
- 8
- 21
2
votes
1 answer
Why does Yarn 2 / Yarn 3 add `packageManager` to package.json, and can I delete it?
After migrating to Yarn 2 / Yarn 3 (running yarn version set stable), yarn added a field to my package.json:
"packageManager": "yarn@3.2.3",
What is this field for? Can I safely delete it?

Matthias
- 13,607
- 9
- 44
- 60
2
votes
1 answer
Why is my yarnrc.yml file missing from my project?
I'm on yarn version 3.2.0 and trying to deploy a project on Heroku and it's telling me that I need the yarnrc.yml file but it is missing. I've tried running yarn, yarn install, yarn set version berry, and yarn set version stable but the file will…

hiddencilantro
- 21
- 1
- 3
2
votes
2 answers
How to install node packages and their dependencies before some date?
Is there any possibility to install node packages (no matter by npm or yarn) and their dependencies released before some date? It looks that it's technically possible, because all versions have the corresponding date release, but I don't see any…

nitrovatter
- 931
- 4
- 13
- 30