Questions tagged [yarnpkg]

This tag is for Yarn v 1.x. See version-specific tags, as version differences are significant. Yarn is an open-source JavaScript package manager. With Yarn, engineers have access to the npm registry and can install packages quickly, and manage dependencies consistently across machines or in secure offline environments.

Yarn is a fast, reliable and secure package manager for Node.js and JavaScript projects, which is compatible with the npm package registry. It aims to avoid the issues caused by npm, such as non-deterministic installations, complex dependency trees, and unreliable package combinations.

Yarn takes inspiration from Cargo, the Rust package manager, and Bundler, a Ruby tool.

The majority of packages created with npm (version 3) should be compatible with Yarn and the node_modules directory produced should satisfy all dependencies.

When should I use ?

Use when your question directly relates to Yarn. Questions about package installation issues, or Yarn's performance are in the scope of this tag and are welcome under .

Don't tag questions just because you use Yarn in your project when it's clearly not relevant to the core of your question. For example, "Why doesn't this if statement work?" is off-topic for this tag even if you used Yarn to set it up. Consider or instead for these questions.

Useful References

Comparison of npm and Yarn commands

  • yarn add = npm install --save
  • yarn global add = npm install --global
  • yarn ls = npm ls
4134 questions
2
votes
2 answers

How to install a npm package from github requiring a build step, e.g. when forking a library?

Assume you use a library like vue3-datepicker. You realize you need to customize something, and as as first step you want to use a custom fork of it. The issue is, there is a build step when the package is pushed to npm's registry since the project…
k0pernikus
  • 60,309
  • 67
  • 216
  • 347
2
votes
0 answers

The new Husky Hooks is not working properly on Linux

I just started the project and followed the documentation (https://typicode.github.io/husky/#/), where I applied the following steps: npx husky-init && yarn # Yarn 1 npx husky add .husky/commit-msg 'npx --no-install commitlint --edit "$1"' After…
THIAGO DE BONIS
  • 760
  • 7
  • 22
2
votes
0 answers

punycode is deprecated in npm - what should I replace it with?

I'm using the npm module punycode in my Angular project. VsCode tells me it's deprecated and https://nodejs.org/api/punycode.html#punycode_punycode confirms: The version of the punycode module bundled in Node.js is being deprecated. In a future…
Ben Taliadoros
  • 7,003
  • 15
  • 60
  • 97
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

Yarn workspaces with babel, ts, etc?

Is there a "correct" way to have globally available scripts w/ yarn workspaces? Let's take typescript as an example. If I install it at the root level using yarn add -W typescript it's not available in any of my workspaces: child-workspace$ yarn…
user578895
2
votes
1 answer

Should I make multiple node_modules folders for multiple files or use one?

I am starting a JavaScript project and its parent directory contains 2 folders: client and server. Both of these will require Javascript packages but I'm confused as to whether I should make a node_modules folder in each of them for their respective…
ani
  • 303
  • 3
  • 15
2
votes
1 answer

How to make a dynamic path on a package.json script

On my package.json I have this script "test": "hardhat test". I would like to make another one to only run tests from a subfolder, and not the entire test suite. Something like "test:single": "hardhat test ./tests/subfolder/${runThisOne}" and call…
Eduardo Robles
  • 495
  • 1
  • 5
  • 7
2
votes
1 answer

Integrity check failed for "anymatch" (computed integrity doesn't match our records, got

I have a node.js project (Nest JS to be more specific), where i am trying to reinstall my depdency after getting the same error as described below. I have not seen something like this before. I checked the yarn.lock and pacakge.json files nd the…
Kristoffer Tølbøll
  • 3,157
  • 5
  • 34
  • 69
2
votes
0 answers

How to enable VS Code auto-imports with Yarn 2.0's link: protocol and Typescript

I am using Yarn 2 with PnP enabled and Typescript. In my dependencies, I have "app": "link:./" for absolute imports as described here, no paths or baseUrl in my tsconfig. What I want is auto-import of files to be absolute too and not relative. I…
2
votes
1 answer

Can I import submodules outside of the "main": "index.js" file from a local yarn workspace dependency package?

I have the following monorepo structure (using yarn workspaces). packages common src index.js module1.js module2.js package.json user src index.js moduleA.js mobuleB.js …
cbdeveloper
  • 27,898
  • 37
  • 155
  • 336
2
votes
0 answers

What is causing yarn-error.log and how does this affect my project?

I have recently installed yarn to my project to run cypress tests. But I'm getting this yarn-error.log file, and I'm wondering what is generating that and how could this affect my project? I do not understand the error that I get in it. I already…
2
votes
0 answers

Module not found: Can't resolve '@your-org/core-lib' in nextjs?

I am new in monorepo or yarn workspace .So learning I follow this starter boilerplate https://github.com/belgattitude/nextjs-monorepo-example I forked the above example .And run yarn command on root folder .Initially I got this error Couldn't find…
user5711656
  • 3,310
  • 4
  • 33
  • 70
2
votes
1 answer

Fullscreen Electron application on startup

I have created an application with Vue and Node in Electron. I run the application using command yarn run electron:serve. How can I get this application to start in full screen mode? Consider that even when the application is built, I want it to…
2
votes
1 answer

Installation of private npm package from CodeArtifact fails with "401 Unauthorized" with yarn and yarn.lock

We have a private npm package in CodeArtifact that we want to install as part of our package.json. We are using Yarn as a package manager and have a yarn.lock file to control the versions. When trying to install with yarn install --frozen-lockfile…
Lola Bach
  • 101
  • 1
  • 3
2
votes
0 answers

Why are utf16 / surrogate pairs emojis not displayed correctly in console.log() when run through yarn on Windows? (npm and node directly are fine)

Somehow running console.log('Thunderbirds are go! ') via yarn / node does not display the emoji but outputs � instead. I'm on Windows Terminal / Git Bash which in itself has no problems displaying utf-16 surrogate pairs. Running a script through…
Meldon
  • 730
  • 2
  • 6
  • 13