Quantcast
Channel: Node.jsタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 8837

[m1]asdfでバージョン管理を行なったnodejsを使うまで[mac]

$
0
0
asdfとは いろんな言語のバージョン管理がまとめてできるやつ(雑) 類似ツール: anyenv 環境 MacBook Air (M1, 2020) asdf % brew install asdf zshを使ってるので以下を実行 % echo -e "\n. $(brew --prefix asdf)/asdf.sh" >> ${ZDOTDIR:-~}/.zshrc node 準備 % brew install gpg gawk % asdf plugin-add nodejs インストール可能なバージョンの確認 % asdf list all nodejs 最新安定板の確認/インストール % asdf latest nodejs 16.2.0 % asdf install nodejs latest バージョン指定の場合はこっち バージョンは適当な例 % asdf install nodejs 12.22.1 インストールしてあるバージョンの一覧確認 % asdf list nodejs 16.2.0 % asdf list nodejs 16.2.0 とりあえずのプライマリバージョン設定 % asdf global nodejs 16.2.0 有効なバージョンの確認 % asdf current nodejs 16.2.0 /Users/ユーザー名/.tool-versions % asdf current nodejs nodejs 16.2.0 /Users/ユーザー名/.tool-versions % cat ~/.tool-versions nodejs 16.2.0 % node -v v16.2.0 globalやらlocalやら叩くと各所に .tool-versions ってファイルができてそこに記録されるらしい gitとかで管理すれば環境構築の時とかバージョンはそこ見てねとかで済みそう 適当にファイル作って実行してみる % touch test.js test.js console.log("hello world"); % node test.js hello world

Viewing all articles
Browse latest Browse all 8837

Trending Articles