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
5
votes
0 answers
How to add local .tgz file with Yarn 2?
I am trying to install a module onto an offline computer using Yarn 2.
I have the .tgz file of the NPM module. It looks like it can be done with Yarn 1.x but does not appear to work with Yarn 2.
I put the file lowdb-1.0.0.tgz into the root of the…

calarin
- 226
- 1
- 10
5
votes
1 answer
custom modules folder in yarn2
I'm currently in the process of upgrading to yarn 2 and with classic yarn (yarn 1) we used to install packages in a custom folder using --modules-folder as described here
I don't find a equivalent option or a way to do it with yarn 2.

Subash
- 3,128
- 6
- 30
- 44
4
votes
1 answer
Yarn 3.1, Vite 2.9, cannot find package vite
When trying to build the app with Vite I'm seeing an error. If I understand it correctly there seems to be an issue with Yarn PnP resolving dependencies (no more node_modules), and Vite does not seem to pick up on this? How can I make Vite…

Michael Johansen
- 4,688
- 5
- 29
- 47
4
votes
1 answer
yarn zero install - missing packages from unplugged directory but can't commit local unplugged directory
Switching to the yarn zero installs approach (see https://yarnpkg.com/features/zero-installs) I encountered errors in the following style when running our CI pipeline:
/app/.pnp.cjs:47262
throw firstError;
^
Error: Required unplugged package…

GoWithTheFlow
- 252
- 6
- 16
4
votes
2 answers
How to use Yarn 2 (or 3) to run create-react-app without specifying a new directory?
I am trying to migrate from NPM to Yarn for the sole reason of getting rid of 'node_modules' folder.
I am trying to use CRA tool. However, on CRA it advises to use yarn create, which is not a command found in Yarn 2 documentation. After some…

mongonoob
- 103
- 1
- 5
4
votes
0 answers
How to run package binary installed with Yarn 2
I'm giving Yarn 2/Berry a shot and I'm having trouble figuring out how to run a binary installed by a package.
I'm specifically trying to run GRPC typescript compilation. I have the following command in a bash script which works with Yarn 1:
yarn…

Paymahn Moghadasian
- 9,301
- 13
- 56
- 94
4
votes
1 answer
Is there a way to install dependencies for just one package in a yarn2 monorepo?
to do a yarn immutable install for all packages it yarn 2 recommends yarn workspaces focus --production --all, is there a way to do this for just one workspace? reason being I would like to not have all dependencies for everything installed into…

xenoterracide
- 16,274
- 24
- 118
- 243
4
votes
2 answers
yarn berry run how to run installed packages
I see with yarn berry I get the plug'n'play feature instead of node_modules/
I couldn't find anything to suggest it supports running from installed packages.
For example with npm a workflow might be to run the installed version of webpack:
$ npm…

zhablok breeblebrox
- 55
- 1
- 3
4
votes
3 answers
How to debug Jest Tests when using Yarn 2 / Yarn PnP
I'd like to use the node --debug-brk feature described in a previous answer and the jest docs to debug in npm/yarn 1 based projects, but node_modules/ is not present in Yarn 2 / PnP (Plug n Play) based projects, so those instructions won't work for…

Cameron Yick
- 708
- 1
- 8
- 16
3
votes
1 answer
How do I use Vite with Yarn Workspaces?
At my workplace we were trying to get Vite working with Yarn Workspaces (in yarn v2).
We wanted to create a test environment where we consumed one of the packages we were publishing from the same repository but a different workspace. To…

Armand Bernard
- 449
- 1
- 3
- 12
3
votes
1 answer
How can I deactivate or downgrade the Yarn package manager using corepack?
Following Yarn#Installation guide to installing the yarn@3.4.1 package manager using below command:
corepack prepare yarn@3.4.1 --activate
yarn -v
3.4.1
Now, I want to deactivate or downgrade the Yarn to the previous version in the system. The…

Lin Du
- 88,126
- 95
- 281
- 483
3
votes
0 answers
TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" for gulpfile.ts
I get the error running yarn run package. Adding NODE_OPTIONS="--loader ts-node/esm" didn't help.
I have seen https://github.com/TypeStrong/ts-node/issues/1062 but I tried different targets and that didn't help.
package.json:
...
"scripts": {
…

Motoko
- 1,062
- 2
- 15
- 32
3
votes
0 answers
What do the columns in Modern 'yarn upgrade-interactive' mean?
What is the meaning of the column labels displayed by Yarn Modern's yarn upgrade-interactive?
As near as I can tell
"current" means the currently specified range in package.json,
"range" sometimes means the currently available package that matches…

orome
- 45,163
- 57
- 202
- 418
3
votes
1 answer
Is it possible to init yarn berry over a proxy?
Recently I've upgraded my node version to 16.15.1. Before the node upgrade I used a 1.x yarn version. Now I want to use yarn v3.2.x in my project.
Normally this would be achieved by executing the command yarn init -2 in the console. This would…

poisn
- 437
- 2
- 17
3
votes
2 answers
Syntax errors on VS Code with Vue3 + TypeScript + Vite
I'm setting up a new project using Vite, Vue 3 and Typescript. To do so, I'm using yarn
yarn create vite
I then get prompted for the project name (vite-project), then the framework (vue) and then the variant (vue-ts).
✔ Project name: ……

Goncalo Oliveira
- 341
- 2
- 12