0
1

[WSL2 Ubuntu] nvmからasdfへの移行

Posted at

nvmによるNode.js及びnpmの削除

  • こちらの記事を一部(.bashrcなどに)読み替えればOK!
  • 尚、$ rm -rf $NVM_DIR により、nvm自体も削除されています

asdfの導入

  • 未だ入っていないなら $ sudo apt install curl git
  • $ cd としてホームディレクトリへ移動
  • $ git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.13.1(バージョンは下記公式サイトを参照して下さい)
  • ~/.bashrc の最後尾に次の記述を追加
.bashrc
# asdf setting (Bash & Git)
. "$HOME/.asdf/asdf.sh"
. "$HOME/.asdf/completions/asdf.bash"
  • $ source ~/.bashrc として反映
  • ~/.default-npm-packages に次の記述を追加
.default-npm-packages
yarn
typescript
ts-node
typesync
npm-check-updates
  • Node.jsインストールのためのプラグイン及びNode.js本体をインストールし、グローバルに使用するNode.jsのバージョンを指定
  1. $ asdf plugin add nodejs
  2. $ asdf install nodejs latest
  3. $ asdf global nodejs latest
  • $ node -v として確認
  • 尚、.default-npm-packages に記述したnpmパッケージ群は、Node.jsインストールに伴い、自動でインストールされます

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