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
48
votes
12 answers

Pass command line -- argument to child script in Yarn

I have a package.json that looks similar to this: "scripts": { "dev": "cross-env BABEL_ENV=client webpack --config webpack/client.development.js && yarn dev:stub-server | cross-env BABEL_ENV=server babel-node src/server/server.js", …
Luciano M. L.
  • 709
  • 1
  • 5
  • 9
48
votes
7 answers

How do I create a React Native project using Yarn?

I am running the following commands in the DOS console on a Windows 7 (64-bit) machine. npm install -g yarn yarn add global react-native yarn add global react-native-cli react-native init sample After running react-native init sample, the console…
Prabhakaran Ramaswamy
  • 25,706
  • 10
  • 57
  • 64
47
votes
3 answers

Command not found: corepack when installing Yarn on Node v17.0.1

I'm following the Yarn installation instructions on Yarn's website (https://yarnpkg.com/getting-started/install). Those instructions say that on Node version 16.10.0 and higher you can install Yarn by enabling corepack with the following…
Stud Sterkel
  • 883
  • 1
  • 8
  • 17
47
votes
2 answers

How to use yarn workspaces with typescript and out folders?

I'm trying to set up a monorepo using yarn. I'm confused as to how to set up typescript with project references such that things resolve properly. For example, if I have a folder structure like /cmd /client And I want cmd to depend on client I…
devshorts
  • 8,572
  • 4
  • 50
  • 73
47
votes
2 answers

Switch to npm for create-react-app

I recently installed yarn on my machine but was using npm before. For my current project in React I want to use npm again. However, if I run create-react-app it is built with yarn. How can I switch so that it is created with npm?
Oliver
  • 1,181
  • 2
  • 12
  • 30
47
votes
4 answers

How do I search for packages using yarn?

How do I search for packages with yarn? I want to get a list of results that have the search term in the name of the package as well as in descriptions (similar to how various utilities work like npm search, apropos, apt-cache search). I tried yarn…
labyrinth
  • 13,397
  • 7
  • 35
  • 44
46
votes
2 answers

yarn upgrade to fix yarn audit errors

So, as of now, it appears that there is no yarn audit --fix, so I am trying to figure out how to go about fixing my yarn audit errors. I have tried a yarn upgrade which has fixed some of the errors (which is great), but there are still several…
Ken Bigler
  • 587
  • 1
  • 4
  • 15
46
votes
4 answers

Error: unable to get local issuer certificate while running yarn command

I have my own private npm registry http://something. I installed yarn and trying to run following command. yarn But it is giving following error. Trace: Error: unable to get local issuer certificate at Error (native) at…
thecodejack
  • 12,689
  • 10
  • 44
  • 59
45
votes
3 answers

Can Yarn list all available scripts?

I have some scripts on my package.json { "name": "my-package", "scripts": { "build": "babel src -d lib", "test": "jest" } } Is there a way to list all available scripts from my terminal command yarn ?
Julien Malige
  • 3,295
  • 1
  • 20
  • 39
45
votes
3 answers

why does yarn warn when adding a dependency to the root workspaces package.json

Whenever I add a dependency to the root of the workspaces project: e.g. yarn add assets-webpack-plugin -D I get the following error: Running this command will add the dependency to the workspace root rather than the workspace itself, which might…
dagda1
  • 26,856
  • 59
  • 237
  • 450
44
votes
9 answers

Hanging/stuck reify:prettier: timing reifyNode:node_modules/@nrwl/workspace Completed in 12729ms

Details: ? Workspace name (e.g., org name) swag ? What to create in the new workspace angular-nest [a workspace with a full stack application (Angular + Nest)] ?…
Stackoverfall
  • 942
  • 2
  • 8
  • 21
44
votes
5 answers

Running NodeJS project in Visual Studio Code with yarn

I have a NodeJS project which I can start from command line with yarn start command. My package.json looks similar to this: { "name": "projectname", "version": "0.0.1", "description": "", "author": "My Name", "license": "", "scripts": { …
errata
  • 5,695
  • 10
  • 54
  • 99
43
votes
3 answers

Moving away from Bower (discontinued) to use Yarn/Npm instead (.Net Core MVC) VS2017

I started working on a .Net Core application around 1 year ago. I used .Net Core to set up my project in visual studio and used Bower to manage my client side packages. It seems bower is being maintained/discontinued and the "people in charge"…
Zeliax
  • 4,987
  • 10
  • 51
  • 79
42
votes
7 answers

npm ERR! Unsupported URL Type "workspace:": workspace:*

I'm creating a new project with gatsby gatsby new YourProjectName2 https://github.com/Vagr9K/gatsby-advanced-starter and get an error: info Creating new site from git: https://github.com/Vagr9K/gatsby-advanced-starter.git Cloning into…
pcatre
  • 1,304
  • 2
  • 16
  • 24
41
votes
2 answers

How to turn off yarn@2 PnP?

I am using Yarn 2.0.0-rc.27 + workspaces + TypeScript and I want to turn PnP off and use node_modules again. I tried it with following setting in package.json: "installConfig": { "pnp": false }, However, Yarn uses PnP mode every time. Is there…
user606521
  • 14,486
  • 30
  • 113
  • 204