1
1

More than 1 year has passed since last update.

Yarnのインストール方法(Mac)

Posted at

はじめに

yarn コマンドを実行したら、以下のエラーが発生しました。

$ yarn
bash: yarn: command not found

環境

  • OS:macOS Monterey 12.4
  • Node.js:v16.15.1

原因

Yarnはサードパーティ製のCLIツールであり、Node.jsにはプリインストールされていないためです。

解決策

npmでインストールすればOKです。

$ npm install yarn --location=global

added 1 package, and audited 2 packages in 377ms

found 0 vulnerabilities

$ yarn --version
1.22.4

私はNode.jsをnodebrewで管理しているので、yarnをグローバルインストールしました。
これでプロジェクト配下のみでなく、Node.jsの同じ環境を使うときには常にパスが通ります。

おわりに

yarn コマンドが使えるようになりました。
これでnpmでなくYarnを使ったNode.jsのプロジェクトの開発ができます :relaxed:

参考リンク

1
1
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
1
1