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

How to ignore incompatible engine "node" error on installing npm dependencies with yarn?

Given this package.json: { "name": "yarn-install-fail", "version": "1.0.0", "description": "", "main": "index.js", "scripts": {}, "author": "", "license": "ISC", "dependencies": { "aws-sdk": "2.x.x", "s3-streams": "^0.3.0" …
k0pernikus
  • 60,309
  • 67
  • 216
  • 347
112
votes
8 answers

How do I force Yarn to reinstall a package?

My project has a dependency that I sometimes get from a package server and sometimes get from a local copy I have on my machine. As a result, I frequently need to have Yarn switch where it looks for the dependency. Furthermore, I often change the…
Kevin
  • 14,655
  • 24
  • 74
  • 124
111
votes
5 answers

Why is WSL extremely slow when compared with native Windows NPM/Yarn processing?

I am working with WSL a lot lately because I need some native UNIX tools (and emulators aren't good enough). I noticed that the speed difference when working with NPM/Yarn is incredible. I conducted a simple test that confirmed my feelings. The test…
WrRaThY
  • 1,533
  • 2
  • 10
  • 14
109
votes
9 answers

How to have yarn not issue a warning for the license field?

On running yarn install I see a warning every time that there is no license filed even though I have defined one: $ jq . package.json { "name": "license-example", "version": "1.0.0", "main": "index.js", "license": "UNLICENSED", …
k0pernikus
  • 60,309
  • 67
  • 216
  • 347
103
votes
2 answers

Node engine 8.x or 10.x in package.json

I tried to specify the node engine in a package.json to accept both 8 and 10 version. I tried to type this: "engines": { "node": "8.x|10.x" }, But running yarn results in: The engine "node" is incompatible with this module. Expected version…
rap-2-h
  • 30,204
  • 37
  • 167
  • 263
101
votes
10 answers

How do I change the version of yarn used?

I used Homebrew to install yarn. Running yarn -v shows that I currently use 0.23.2. I ran brew upgrade yarn to get the latest version, which is 0.24.6. After Homebrew successfully upgrades yarn, I run yarn -v again, but the version is still 0.23.2.…
davidhu
  • 9,523
  • 6
  • 32
  • 53
99
votes
18 answers

Could not find plugin "proposal-numeric-separator"

How to fix Could not find plugin "proposal-numeric-separator", I get this error when I try to build my React application, I have not ejected the application yet: ./src/index.js Error: [BABEL] /home/pc/Downloads/project/src/index.js: Could not find…
user7075574
99
votes
8 answers

How to install a list of many global packages with Yarn

yarn install -h suggests that the -g (global) option is DEPRECATED. How am I supposed to indicate that I want a bunch of packages (from package.json / yarn.lock files) to be installed globally? Options I saw: yarn global [command] has things such…
jleeothon
  • 2,907
  • 4
  • 19
  • 35
97
votes
6 answers

What does " yarn build " command do? Are " npm build " and "yarn build" similar commands?

What does yarn build command do ? Are yarn build and npm build the same? If not what's the difference?
sudipt dabral
  • 1,335
  • 2
  • 9
  • 17
94
votes
6 answers

Yarn not installing in nvm version node version

I'm running into an issue with yarn when I change my nvm version of node. I noticed when I check my ~/.nvm folder I see two node versions. v8.11.0 v8.11.3. I installed yarn globally. using npm install -g yarn when I was using v8.11.0. I can…
me-me
  • 5,139
  • 13
  • 50
  • 91
93
votes
6 answers

Docker COPY files using glob pattern?

I have a monorepo managed by Yarn, I'd like to take advantage of the Docker cache layers to speed up my builds, to do so I'd like to first copy the package.json and yarn.lock files, run yarn install and then copy the rest of the files. This is my…
Fez Vrasta
  • 14,110
  • 21
  • 98
  • 160
84
votes
3 answers

How can I update/downgrade package version with yarn?

I have a package and I want to downgrade the version use. How can I do this with yarn "dependencies"?
Emre
  • 951
  • 1
  • 5
  • 7
83
votes
4 answers

Why wouldn't I use npm to install yarn?

In the blog post announcing yarn (an alternative npm client) they say, "The easiest way to get started is to run npm install -g yarn". But if you go to the "install yarn" page in their docs, "npm install yarn" isn't listed on any of the…
Chris Arnesen
  • 1,195
  • 1
  • 9
  • 13
82
votes
6 answers

Install Yarn Ubuntu 16.04 (Linux Mint 18.1)

I have a new installation of Linux Mint 18.1 with Ubuntu 16.04. I have installed Node 6.10.0. When doing the command that indicates the documentation of Yarn: sudo apt-get update && sudo apt-get install yarn It says "could not find yarn package" I…
Jose
  • 1,779
  • 4
  • 26
  • 50
81
votes
6 answers

How can I update global packages in Yarn?

I tried some possible CLI commands but none seem to actually update the packages installed with yarn global add. yarn global upgrade & yarn upgrade global both don't work correctly. Is there a way of upgrading global packages?
thibmaek
  • 1,171
  • 3
  • 13
  • 21