Questions tagged [yarnpkg-v2]
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.
117
questions
38votes
1answer
17kviews
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 ...
15votes
2answers
2kviews
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 ...
12votes
3answers
3kviews
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 ...
12votes
1answer
1kviews
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:...
9votes
2answers
2kviews
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 ...
7votes
1answer
3kviews
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). ...
7votes
1answer
1kviews
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 ...
6votes
2answers
2kviews
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/...
6votes
1answer
7kviews
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
/...
5votes
0answers
371views
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 ...
4votes
1answer
2kviews
Making a dependency's dependencies available with Yarn 2
I'm working on a framework where I want the dependencies of the framework package to be available to the application which consumes it. The dependencies are not directly used by the consumer, but by ...
4votes
1answer
358views
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 ...
4votes
0answers
471views
How do I import a React library from one Yarn workspace into another when hoisting is disabled?
I'm using Yarn v2 (berry) to manage a monorepo with the following structure:
project-root
/packages
react-native-app
(dependencies: my-hooks-lib, react@17.0.1)
my-hooks-lib
(...
4votes
1answer
2kviews
How to use registry scopes with Yarn 2.0 and Azure Artifacts
I would like to use https://registry.yarnpkg.com as my package registry for all packages except 1 that I am hosting on Azure Artifacts.
I have the following .yarnrc.yml file
yarnPath: ".yarn/...
3votes
2answers
2kviews
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) ...
3votes
1answer
631views
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": "...
3votes
2answers
109views
Within in a monorepo, is it possible to configure a package to 'use the uncompiled code if you can'?
I'm playing around with Yarn 2, and I want to do something like this.
I have a monorepo of the structure:
/
packages/
shared-ts/
package.json
src/
lib*/
app-ts/
...
3votes
0answers
653views
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 ...
3votes
0answers
135views
Issue with yarn's lockfile being modified
I'm using yarn berry, specifically version 3.0.0, but was also having the same issue with 2.4.2. When I run yarn install --immutable in CI I get the error:
[2021-07-27T04:51:41Z] ➤ YN0028: │ The ...
3votes
0answers
305views
yarn link and production build
We are using yarn link to refer to internal packages to speedup the dev workflow which has been helping great since we don't have to publish for each change.
However, when we want to create a ...
2votes
2answers
1kviews
Using Yarn 2 (Berry) for packaging application in a Docker image
I'm migrating a VueJS application from "classic" Yarn 1.x to Yarn 2. Following the install documentation is straightforward and works without problems.
The tricky part comes when packaging ...
2votes
1answer
437views
Can you use Yarn2 PnP "zero-installs" on a machine without Yarn?
I'm playing with Yarn 2's "zero install" stuff for a minor tool to address one of my boss's random allergies. (He takes umbrage at the expectation of having to run npm i on a cloned repo to ...
2votes
1answer
237views
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 ...
2votes
1answer
832views
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 ...
2votes
2answers
3kviews
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 ...
2votes
2answers
815views
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 ...
2votes
1answer
495views
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 ...
2votes
0answers
374views
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 ...
2votes
2answers
727views
`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, ...
2votes
0answers
646views
How to configure Yarn Berry, Eslint with GlobalCache in VsCode?
Is there a way to install EsLint with Yarn Berry with yarn option enableGlobalCache: true in VsCode ?
I installed the ESLint (dbaeumer.vscode-eslint) extension and all dependencies :
"...
2votes
0answers
172views
ts-jest disable babel, babel still appears to be running
So the docs say it should not be; but I'm seeing this output.
➤ YN0000: [@bb/graph]: [BABEL] Note: The code generator has deoptimised the styling of /home/runner/work/services/services/.pnp.js as it ...
2votes
1answer
1kviews
Storybook 5.3 issue with yarn version 2
For a project requirement, I am configuring storybook 5.3 for react component development. I am using Yarn version 2 as the package manager.I've done all the steps mentioned in the storybook tutorial. ...
1vote
2answers
2kviews
How to list and use packages in Yarn 2?
Since I'm a beginner with Yarn, therefore I have followed the current Yarn tutorial, and it describes Yarn 2. So I have installed Yarn 2. yarn --version command gives 2.0.0-rc.34.
But Yarn 2 seems to ...
1vote
1answer
188views
Yarn V2 (Berry) Workspaces with Peer Dependencies
I'm trying to switch to yarn workspaces, in V2 but keep getting an Invalid dependency range error for the new workspaces: syntax when used with peerDependencies
I've tried using an exact range, ...
1vote
1answer
2kviews
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 ...
1vote
1answer
103views
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 ...
1vote
1answer
134views
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 ...
1vote
1answer
424views
CRA + Yarn 2 + jsconfig.json = Can't run unit tests
I have the following configuration in my jsconfig.json file:
{
"compilerOptions": {
"baseUrl": "./src"
},
"include": ["src"]
}
Which lets ...
1vote
1answer
1kviews
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 ...
1vote
2answers
31views
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 ...
1vote
0answers
62views
After migrating to yarn 3 workspace "Cannot use import statement outside a module" running react-scripts test
I have a repository with yarn 3 workspaces and a CRA front end located in /packages/client
yarn workspace client start successfully launches the development app on port 3000.
The test suite ran ...
1vote
0answers
52views
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 ...
1vote
0answers
163views
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 ...
1vote
0answers
33views
Trading view library is not working on Production
i have used trading view charting library in react
its working perfect in development but in production its not working
when i used yarn build these warnings came in console but build successfully ...
1vote
0answers
788views
yarn create react-app not working and aborting installation
I tried installing a react-app using yarn and got this error message:
yarn version: 1.22.17
npm version: 8.3.0
It is also showing an error of "No Lockfile found".
$ yarn create react-app ...
1vote
0answers
370views
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"
...
1vote
0answers
216views
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 ...
1vote
0answers
65views
Yarn not recognizing built in package?
I have the following code snippet in my app:
import { createBrowserHistory } from 'history';
export default createBrowserHistory({ basename: '/dev' });
This function, and its typings, exist in ...
1vote
0answers
228views
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 ...
1vote
0answers
234views
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 ...