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
59
votes
7 answers

How to know the version of currently installed package from yarn.lock

I am writing an internal tool which compares the version installed in a project and only allow certain version to be passed. For that I have to check the version which is resolved in the yarn.lock file, as package.json file has a semver range, not…
0xC0DED00D
  • 19,522
  • 20
  • 117
  • 184
59
votes
1 answer

What is main difference between yarn and npm?

I want to ask what is your favorite package manager for JS ? I saw some articles about yarn and npm. But I am not sure what can be better for me. I just start learning JS. Right now difference between yarn and npm is for me like difference between…
user9772177
59
votes
2 answers

What is the difference between yarn.lock and npm's shrinkwrap?

Recently I tried installing my Node packages with Yarn. It works great and it's a lot faster than NPM. Yarn automatically generates yarn.lock. We already have NPM shrinkwrap (npm-shrinkwrap.json). Is there any difference between them? Does…
Fizer Khan
  • 88,237
  • 28
  • 143
  • 153
54
votes
4 answers

How to cache yarn packages in GitHub Actions

I am using GitHub Actions to build my TypeScript project. Everytime I run action I am waiting 3 minutes for all dependencies to get installed. Is there way to cache yarn dependencies, so build time will be faster? I tried this: - name: Get yarn…
Baterka
  • 3,075
  • 5
  • 31
  • 60
54
votes
7 answers

How to specify local registry in yarn?

I have a local nexus server, I'd like yarn to look through it before going online, basically prefer-offline yarn install \ --prefer-offline \ --cache-folder C:\folder\yarn-cache \ --preferred-cache-folder C:\folder\yarn-cache \ …
Lynob
  • 5,059
  • 15
  • 64
  • 114
53
votes
6 answers

How to make create-react-app use npm instead of yarn?

I kind of rushed into creating a React app based on a tutorial that used yarn. Now I'm going to re-create the app from scratch because I'm not satisfied with the reactstrap library, and I'd like to switch to react-bootstrap. I've re-installed node.…
Jack BeNimble
  • 35,733
  • 41
  • 130
  • 213
53
votes
30 answers

Error: yarn start - error Command "start" not found

I am trying to learn React and I am using a private repo to start with it. I run yarn start in the directory of the repo but I get the error message: yarn run v1.13.0 error Command "start" not found. info Visit https://yarnpkg.com/en/docs/cli/run…
Magofoco
  • 5,098
  • 6
  • 35
  • 77
53
votes
23 answers

Issue with babel-jest dependency when running npm start in a React app

All I am doing is running create-react-app and cd'ing into the app, then trying to run npm/yarn start. I get the following error/output/log. I have walked through all of the suggested steps. The only thing that works is the SKIP_PREFLIGHT_CHECK=true…
jasonspiller
  • 543
  • 1
  • 4
  • 6
53
votes
2 answers

Yarn local packages dependencies

I have the following folder structure: ~ (user home folder) - api ... - package.json - lib - libA ... package.json - libB ... package.json In libA/package.json I have the following local…
Laxmana
  • 1,606
  • 2
  • 21
  • 40
52
votes
3 answers

What does "Linking Dependencies" during npm / yarn install really do?

For large web apps npm install resp. yarn install does take a lot of time, mostly in a step called Linking Dependencies. What is happening here? Is it fetching the dependencies of the dependencies? Or something completely different? Which files are…
medihack
  • 16,045
  • 21
  • 90
  • 134
51
votes
13 answers

npx create-react-app prompting to globally uninstall non-existent create-react-app package?

I am having problems with npx create-react-app involving global installs. My confusion arises because as far as I'm aware the create-react-app package is not installed on my machine. Some Details: I start a react project (with typescript template)…
Forrest Naylor
  • 513
  • 1
  • 3
  • 6
51
votes
1 answer

What is the difference between yarn.lock and npm's package-lock?

I accidentally ran npm install in a project that uses Yarn and noticed that npm created a package-lock.json file. I know that Yarn spiked in popularity in part because it used a lockfile to produce more reliable and deterministic dependency…
fny
  • 31,255
  • 16
  • 96
  • 127
49
votes
4 answers

Yarn 5x slower on windows

When I add a new package to an existing installation where yarn install has already been run, it takes 5 minutes to add a new dependency, which is as slow as if I just did yarn install without node_modules there yet. Is this normal? I'm using Yarn…
Attila Szeremi
  • 5,235
  • 5
  • 40
  • 64
49
votes
1 answer

How to create run configuration with Yarn instead of npm in WebStorm 2016.2.3

I used to work with npm via WebStorm. I usually just add a npm based run configuration in the right corner, like what described in here. I recently tried Yarn and I'm trying to do similar thing like with npm, however I can't find the options. Is…
Daniel W
  • 1,092
  • 1
  • 12
  • 25
48
votes
17 answers

yarn is having troubles with the network connection

I tried to install a package with yarn earlier today and I got this yarn install yarn install v1.9.4 [1/4] Resolving packages... info There appears to be trouble with your network connection. Retrying... info There appears to be trouble with your…
dragi
  • 1,462
  • 5
  • 16
  • 28