Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to list and use packages in Yarn 2?

Since I'm a beginner with Yarn, therefore I have followed the current Yarn tutorial, and it describes Yarn 2. So I have installed Yarn 2. yarn --version command gives 2.0.0-rc.34.

But Yarn 2 seems to lack a command to show the list of the packages installed locally. I know that Yarn 1 has the list command, but I cannot find any similar command in Yarn 2.

I use Yarn 2 for a new empty project, I have added webpack with the command yarn add -D webpack webpack-cli. Yarn 2 seems to store packages completely differently -- it hadn't created node_modules directory, it seems to use the .yarn directory for the packages. So npm list shows nothing.

Furthermore when I try npx webpack --help, npm doesn't find webpack, and proposes to install it with yarn add -D, though I had done that already.

So how to see a list of all installed packages, and how to make npm see them with Yarn 2?

My system is Linux Mint 19.3, Node.js version is 12.18.0, npm version is 6.14.4. Node.js was installed from the deb.nodesource.com/node_12.x repository.

like image 928
Kydesnic Avatar asked Nov 17 '25 02:11

Kydesnic


1 Answers

Not a timely response, but it may still be of use. With Yarn 2.4.0, running yarn info --recursive --dependents in the root of your repo will list them. There are other options, check out yarn info

like image 106
Samantha UK Avatar answered Nov 18 '25 20:11

Samantha UK