0
0

More than 1 year has passed since last update.

[Node.js] yarnとは何か

Posted at

目的

rails6のアプリケーションを作成した際にyarnのインストールが必要だったため、yarnについて簡単にまとめた

yarnとは

  • npmと同じで、nodeのパッケージ管理マネージャー
  • rails6ではWebpackerを標準で使い、Webpackerはyarnを使うのでインストールが必要になる。

コマンド使用方法

初期化

# packeage.json作成
yarn init

インストール

yarn add パッケージ名
yarn add パッケージ名@x.y.z

# devDependenciesにインストール
yarn add パッケージ名 -dev

# グローバルインストール
yarn add global パッケージ名

# すべてインストール
yarn

アップデート

yarn upgrade パッケージ名
yarn upgrade

アンインストール

yarn remove パッケージ名

実行

yarn パッケージ名

比較表

 コマンド    npm     yarn  
初期化 npm init yarn init
インストール npm i yarn add
アップデート npm update yarn upgrade
アンインストール npm remove yarn remove
実行 npx react パッケージ名 yarn パッケージ名

参考にさせていただいた記事

npmとyarnについて解説

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0