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
78
votes
5 answers

Jest test fails with "window is not defined"

I am trying to get started with state-of-the-art web development learning React and Redux. Right now I am stuck at getting tests running. For some reason, Jest fails with Task :frontend:test yarn jest v1.0.2 $…
Gunnar Eketrapp
  • 2,009
  • 1
  • 19
  • 33
78
votes
4 answers

What is the difference between yarn run and npm start?

Is yarn run intended to be the equivalent of npm start?
daniely
  • 7,313
  • 5
  • 29
  • 46
76
votes
4 answers

Yarn - remove package best practices

If you want to remove a package using Yarn should you: run yarn remove [package] or delete it from package.json and run yarn install Do both work the same? Will #2 update yarn.lock?
mattnedrich
  • 7,577
  • 9
  • 39
  • 45
76
votes
6 answers

How can I version bump all my dependencies?

Having yarn outdated is quite informative but I'd like to avoid running over package by package doing yarn upgrade. From yarn's documentation, just yarn upgrade without arguments is said to upgrade all dependencies but there's no change in my…
tutuca
  • 3,444
  • 6
  • 32
  • 54
75
votes
6 answers

Why does yarn install dev dependencies but I just need the builds?

If I use yarn add , Yarn will install both dependencies and devDependencies of . Is it intended? I checked the documentation but I couldn't find a way to prevent installing the development dependencies. devDependencies…
vdegenne
  • 12,272
  • 14
  • 80
  • 106
73
votes
7 answers

Is there any harm in using NPM and Yarn in the same project?

I have been using npm for a personal project and just recently stumbled across yarn. Would there be any harm or "intended side effects" to switching to yarn's package manager in the same project where I had been using npm?
Dom Hallan
  • 1,057
  • 1
  • 8
  • 16
72
votes
16 answers

An unexpected error occurred: "EPERM: operation not permitted in Yarn

I am having problems installing new npm packages with Yarn. Every time I go on to add a new package it's throwing me this error. But when I delete my node_modules folder and run Yarn, everything works fine. Again when I try to add another package,…
Pranta
  • 2,928
  • 7
  • 24
  • 37
69
votes
4 answers

How to display yarn globally installed packages?

I am using macOS Sierra 10.12.4 and I have installed yarn by brew install yarn and its version is yarn version v0.23.2 I installed angular-cli, bower and ionic using yarn global add Then I use yarn global ls to display globally…
Haifeng Zhang
  • 30,077
  • 19
  • 81
  • 125
65
votes
3 answers

Install devDependencies and dependencies together with yarn

Is it possible to install devDependencies and dependencies together with yarn? For example, if I want to install react and webpack. React is a dependency and webpack is a dev dependency. To install both, I need to run these two commands yarn add…
Pranesh Ravi
  • 18,642
  • 9
  • 46
  • 70
65
votes
4 answers

What is the difference between brew, yarn, and npm?

I was using the react-native package which I installed globally with npm. Now it says at the first line after executing the init command. The following: Installing react-native from npm... Consider installing yarn to make this faster:…
user007
  • 1,557
  • 3
  • 16
  • 24
64
votes
2 answers

How to increase the timeout for `yarn install`

I'm currently using Yarn on a very unstable internet connection. Sometimes it takes hours until I can finally download all the packages. I noticed Yarn retries the download when there is some kind of the internet connection: [1/4] Resolving…
Fabio K
  • 1,297
  • 4
  • 13
  • 24
62
votes
6 answers

Incorrect integrity when fetching from the cache

When running yarn add --dev jest, I got error Incorrect integrity when fetching from the cache. Full output: tests (master)$ yarn add --dev jest yarn add v1.19.0 info No lockfile found. [1/4] Resolving packages... warning jest > jest-cli >…
Doug Richardson
  • 10,483
  • 6
  • 51
  • 77
62
votes
2 answers

How to sync `yarn.lock` with `package.json`?

I installed a package with yarn add --dev, run its setup process and during it, the package installed several other packages and added those to package.json (in devDependencies), I assume with npm. Great, but now my yarn.lock is out of sync. What is…
Mauricio Pasquier Juan
  • 2,265
  • 3
  • 27
  • 39
61
votes
1 answer

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 nested folders in there like .yarn/cache? Also,…
Alexandr Panteleev
  • 715
  • 1
  • 5
  • 9
61
votes
5 answers

Yarn: unable to verify the first certificate

I'm trying to migrate from npm to Yarn. When I tried to install dependencies through yarn, I'm getting this error. unable to verify the first certificate at Error (native) at TLSSocket. (_tls_wrap.js:1055:38) at emitNone…
Manikandan
  • 3,025
  • 2
  • 19
  • 28