How to install all the dependency package in yarn?
Solution 1
You should just be able to run yarn install
Here is a comparison table of most/all the commands you'd likely encounter
Edit Sept 2020: The newer versions of npm
have greatly improved and caught up to yarn
, so I currently have no clue what possible benefits yarn
offers anymore, I'm 100% npm
for the last year or so
Solution 2
The equivalent of $ npm install
is just $ yarn
(without arguments) to install all dependencies from package.json.
Also, just to clarify your query -
Just found that it has only package.json, which means I can only use npm install to install dependencies. Would there be no problem when I use yarn later?
Doesn't matter whether you use yarn or npm, there will always be a package.json
.
And no, there won't be a problem when using yarn later.
You get package-lock.json
when using npm, and yarn.lock
file when using yarn.
It's not recommended to use both yarn and npm for the same project, so you should remove either of package-lock.json
and yarn.lock
.
Jay P.
Updated on June 12, 2022Comments
-
Jay P. almost 2 years
First, I'm new to React. I'm trying to use Google's
Material-UI
for my React project. In this tutorial, it says runnpm install
, but I heard usingyarn
andnpm
together in the same project because it might bring about some confusion between those two later. So, I'm trying to stick toyarn
only.npm install
seems to install all the dependency package for the thing that I wanna use, but how can I do that in yarn? I triedyarn add
, but it didn't work. How can I do that?EDIT
Just found that it has only
package.json
, which means I can only usenpm install
to install dependencies. Would there be no problem when I use yarn later? -
Jay P. over 5 yearsthat link gives me a big help! Thanks a lot
-
robvelor over 2 years@Thymine Yarn still edges out npm because it supports simultaneous package installs.