LoginSignup
0
0

More than 5 years have passed since last update.

node.js 環境を構築する際のコマンド

Last updated at Posted at 2017-10-31

https://qiita.com/seibe/items/36cef7df85fe2cefa3ea を見ながらWSL上にNode.js環境を作った際のメモ。

インストール

node.js のインストール

n package を使って node.js をインストール後、古い node.js を削除。

sudo apt -y nodejs npm
sudo npm cache clean
sudo npm install n -g
sudo n stable
sudo apt purge -y nodejs npm

残しておきたい依存関係だけ、手動でインストールしたとマーク。

sudo apt-mark manual libfreetype6 gyp libssl-dev libssl-doc python-pkg-resources zlib1g-dev

いらない依存関係を削除。

sudo apt -y autoremove

yarn のインストール

https://yarnpkg.com/en/docs/install#linux-tab の指示に従ってインストール。

curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update && sudo apt install -y yarn

無理やり古い node.js が入れられるので削除。

sudo apt purge -f libuv1 nodejs

n コマンド

sudo n        # インストールされているバージョンを表示
sudo n stable # 安定版をインストールし有効化
sudo n latest # 最新版をインストールし有効化
sudo n lts    # LTS版をインストールし有効化
sudo n 8.8.0  # 指定したバージョンをインストールし有効化
sudo n rm lts # 指定したバージョンを削除
sudo n prune  # 今使っているバージョン以外を削除
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