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
2
votes
1 answer
Yarn add throws "can't be resolved to satisfying range" when adding a package from a file
I want to add a local dependency to package.json`.
Say I have foo-1.0.0.tgz file.
I do
yarn add file:foo-1.0.0.tgz
And for some reason I have this error
➤ YN0027: file:foo-1.0.0.tgz@unknown can’t be resolved to a satisfying range
➤ YN0035: The…

eXception
- 1,307
- 1
- 7
- 22
2
votes
1 answer
Usage Error When run "yarn start" on yarn berry project
Our team decides to use yarn berry on our project, and one in my team initialize project. So I cloned the project on my local and run "yarn start" in terminal But it is not work.
This is the Error message.
Usage Error: Couldn't find the node_modules…

Chang-Man
- 23
- 1
- 4
2
votes
1 answer
Yarn 3 nodeLinker: node-modules
Why does yarn create a ".yarn/cache" directory when using node-modules?
My .yarnrc.yml is:
nodeLinker: node-modules

Михаил Баев
- 21
- 1
- 2
2
votes
0 answers
workspaces internal error when running "yarn dev"
I have a project I cloned from GitHub that was created in Vite+react+tailwind
When I run “yarn dev” I receive the following error
Internal Error: PROJECTNAME@workspace:.: This package doesn't seem to be present in your lockfile; run "yarn install"…

Talenix
- 33
- 2
2
votes
0 answers
How to attach debugger in VSCode to Dockerized Yarn Berry (pnp) process while ignoring package errors?
I'm using the following launch.json to debug my container:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit:…

yaserso
- 2,638
- 5
- 41
- 73
2
votes
2 answers
How to install yarn@2 in azure devops pipeline agent
I'm setting up a build pipeline in azure devops. There's an assistant task called YarnInstaller@3 that allows me to install a specific version of Yarn. However, the only available versions listed are 1.x, with the latest being 1.22.
There are…

rakitin
- 1,943
- 6
- 25
- 51
2
votes
1 answer
Migrating to Yarn 2, but Yarn commands "set" and "policies" not found
I am trying to migrate a project to Yarn 2 like it describes on their website: https://yarnpkg.com/getting-started/migration
When I run yarn set version berry I get this error:
yarn run v1.7.0
error Command "set" not found.
This github forum post…

Michael Silverman
- 31
- 1
- 7
2
votes
1 answer
Update previously patched package with Yarn Berry
I'm using Yarn@3.0.2 in my project.
I have patched a package (@pkg/pkg) with the command yarn patch @pkg/pkg and I am using it as a devDependency with the patch: protocol.
Now I need to make another patch to the same package - but when I run the…

SchlagerKhan
- 61
- 1
- 6
2
votes
1 answer
Adding local dependency in a Typescript project doesn't work when it works in JS
I have been able to import a local package into a project by running yarn link ../path, which adds a resolution field to the package.json to tell the bundler where to find a package, basically giving it an alias.
Weird thing is that while this works…

David Min
- 1,246
- 8
- 27
2
votes
0 answers
export node_modules in yarn berry for aws lambda layers
currently we're using multiple yarn 1.x projects to deploy code to aws.
to export the dependencies for lambda-layers we're currently using
yarn install --production --modules-folder layer/nodejs/node_modules
now we'd like to migrate to yarn berry to…

jaecktec
- 440
- 4
- 15
2
votes
1 answer
yarn 2 upgrade appears to have broke typescript types, where yarn 1 install of same project succeeds?
I have been trying to upgrade a typescript monorepo to make use of yarn 2 but am running into an issue where typescript is no longer able to determine certain react props. Since this was working in yarn 1.x, I am thinking there must have been some…

jdk905
- 495
- 5
- 11
2
votes
1 answer
Husky error on precommit: npm ERR! missing script: pre-commit
I am using latest version of yarn. I am trying to set up Husky in my project.
File .huskyrc.json:
{
"hooks": {
"pre-commit": "lint-staged",
"pre-push": "npm run test:noWatch"
}
}
File lintstagedrc.json
{
"src/**/*.{js,ts,jsx,tsx}":…

Reacting
- 5,543
- 7
- 35
- 86
2
votes
2 answers
`yarn set version from sources` results in "Unrecognized or legacy configuration settings found: changesetIgnorePatterns"
Can't seem to install yarn from sources and I'm not sure how to even debug this sort of thing.
Things I've tried:
homebrew nodejs and yarn
nodejs from official pkg
From the docs I've read, changesetIgnorePatterns should be a valid configuration…

Frank Joseph Mattia
- 593
- 5
- 25
2
votes
0 answers
How can I debug typescript in Yarn2 workspace using vscode?
I have yarn2 (berry) project with workspaces and I'm using ts-node to run each workspace (package). How do I set up the vscode launch.json to be be able to debug a workspace? For clarification, I have a global tsconfig with general configuration and…

daramora
- 21
- 1
- 1
2
votes
1 answer
How can Webpack 5 polyfills resolve with Yarn 2 PnP? (Cypress issue)
I ran into this issue in the context of adding the cypress-dark (theme) plugin to the "test" package of a Yarn 2 workspace, but I think the issue is general. To put a finer point on the original question, I think what I need to know is: how can I…

John Camden
- 592
- 5
- 15