23
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Yarnメモ

Last updated at Posted at 2017-02-18

Yarnメモ

npmと互換のNode用パッケージマネージャ。
yarn.lockファイルで依存パッケージのバージョン固定ができる、異なるバージョンのパッケージを参照した場合にyarn install --flatでバージョン選択できる、yarn installnpm installより速い、あたりが利点か。

プロジェクト作成

$ yarn init

依存パッケージの追加

$ yarn add [package]
$ yarn add [package]@[version]
$ yarn add [package]@[tag]

依存パッケージのアップグレード

$ yarn upgrade [package]
$ yarn upgrade [package]@[version]
$ yarn upgrade [package]@[tag]

依存パッケージの削除

$ yarn remove [package]

package.jsonに記載された依存パッケージのインストール

$ yarn install

package.jsonに記載されたscriptsの実行

$ yarn run [script] [-- <args>]

npmコマンド <-> yarnコマンド

Yarn npm
yarn add [package] npm install --save [package]
yarn add [package] [--dev/-D] npm install --save-dev [package]
- npm install [package]
yarn cache clean npm cache clean
yarn global add [package] npm install --global [package]
yarn install npm install
yarn install --flat -
yarn install --force npm rebuild
yarn remove [package] npm uninstall --save [package]
yarn remove [package] npm uninstall --save-dev [package]
- npm uninstall [package]
yarn upgrade rm -rf node_modules && npm install
23
20
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
23
20

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?