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
184
votes
13 answers

Module not found: Error: Can't resolve 'core-js/es6'

I've got a problem with my build process in relation to my React app. I always get the following error: Module not found: Error: Can't resolve 'core-js/es6' if I use this in a polyfill.js: import 'core-js/es6'; That is my package.json: { …
Gutelaunetyp
  • 2,144
  • 4
  • 15
  • 40
173
votes
7 answers

Should I commit yarn.lock and package-lock.json files?

We're using yarn for all our deterministic pkg installations but don't prevent the user from using npm - I'm guessing having both these files will cause issues however. Should one be added to your .gitignore dir?
BisonAVC
  • 1,980
  • 2
  • 13
  • 12
172
votes
15 answers

error: no template named 'remove_cv_t' in namespace 'std'; did you mean 'remove_cv'?

My problem seems similar to this issue, except it happens when I run yarn install in a rails app. When I run yarn install, it runs successfully for some time, then ../src/libsass/src/ast.hpp:1614:25: warning: loop variable 'numerator' of type 'const…
stevec
  • 41,291
  • 27
  • 223
  • 311
163
votes
13 answers

Yarn - How do I update each dependency in package.json to the latest version?

I have a react app with deprecated dependencies. To make it work, I have to update the dependencies to their newer (but stable) versions. As per this stakoverflow thread, to update dependencies in package.json to latest versions, npm-check-updates…
DevLoverUmar
  • 11,809
  • 11
  • 68
  • 98
160
votes
5 answers

npm equivalent of yarn resolutions?

Is there an npm equivalent of the yarn resolutions functionality? There is no mention of it in the npm package.json docs. For example, I want to install lerna@3.3.2 and one of its dependencies (@lerna/publish) at 3.3.2 as well. Currently doing that…
adanilev
  • 3,008
  • 3
  • 15
  • 20
150
votes
4 answers

How do you resolve Git conflicts in yarn.lock

When multiple Git branches modify the dependencies in a project that uses Yarn, it is likely to introduce a conflict in the yarn.lock file. It is not a good idea to delete and regenerate the yarn.lock file because this will probably cause several…
Christian Schlensker
  • 21,708
  • 19
  • 73
  • 121
150
votes
3 answers

What is the equivalent of "npm install --save" in Yarn?

I am using Yarn to install the dependencies of my project. What is the equivalent of "npm install --save " in Yarn to update the entry in my package.json file? I can use "npm install --save " here, but I want to use…
Manivannan
  • 3,074
  • 3
  • 21
  • 32
147
votes
2 answers

Run yarn in a different path

Is there a way to specify a working directory for yarn? This would be different then the --modules-folder option. Specifically, I'm trying to run the yarn install command from a location outside of the package location. Similar to -C in git
mrbnetworks
  • 2,547
  • 3
  • 17
  • 10
144
votes
18 answers

Support for the experimental syntax 'jsx' isn't currently enabled

I'm trying to run very simple code, but I'm getting an error, I didn't use the create react app! It looks like my babel.config.js file is being ignored! This is the structure of my small project: My html file
Manzini
  • 1,671
  • 2
  • 9
  • 15
137
votes
12 answers

Yarn ERROR: There are no scenarios; must have at least one

I tried to install Yarn and when I used the yarn command I got: 00h00m00s 0/0: : ERROR: There are no scenarios; must have at least one. my yarn --version is 0.32. Why doesn't it work?
Francesco Borzi
  • 56,083
  • 47
  • 179
  • 252
134
votes
3 answers

What does 'has unmet peer dependency' mean when installing a package with yarn?

I have a fresh install of yarn (via npm install yarn -g) and tried to install a few packages with yarn add vue-loader babel-loader style-loader css-loader file-loader webpack I then got a few warnings during the installation, such as warning…
WoJ
  • 27,165
  • 48
  • 180
  • 345
131
votes
3 answers

How do I override nested dependencies with `yarn`?

If my package has these dependencies { "name": "my-package", "dependencies": { "foobar":"~1.0.3", "baz":"2.0.9" } And the foobar package has these dependencies { "name": "foobar", "dependencies": { "baz":"^2.0.0" } and the most recently…
Chris W.
  • 37,583
  • 36
  • 99
  • 136
130
votes
2 answers

When installing packages with Yarn, what does "incorrect peer dependency" mean?

I've just cloned a repo, which recommends the use of Yarn to install dependencies. When I run yarn install, it seems to be okay, but it provides this warning: yarn install v0.20.3 [1/4] Resolving packages... [2/4] Fetching packages... [3/4] …
126
votes
2 answers

How to update package-lock.json without doing npm install?

Question What is the way to update/generate package-lock.json without making a real installation of node_modules (what npm install does)? I want just a valid package-lock.json based on my package.json, that's it. Motivation You might use yarn…
S Panfilov
  • 16,641
  • 17
  • 74
  • 96
126
votes
12 answers

is there a yarn alternative for npm audit?

need pinned resolution feature of yarn, but also want to audit with npm audit? Is there a yarn alternative to npm audit? Or, alternately, will pinning resolutions of dependencies of dependencies work in npm?
sjt003
  • 2,407
  • 5
  • 24
  • 39