LoginSignup
0

More than 1 year has passed since last update.

posted at

GCP nodejs環境構築手順(nodeのバージョンを指定)

ほぼ自分用のメモです。

1インスタンス作る

インスタンスがmicroだと手順5で out of memoryになって進めない

2sshでコンソールに入る

これはSSHクリックするだけ

3gitをインストールする

$ sudo apt-get update # いろいろパッケージを更新
$ sudo apt-get install git # git インストール
$ which git

参考
https://zenn.dev/suyaa/scraps/a0e84f9cbf403b

4homebrewをインストール

git clone https://github.com/Homebrew/brew homebrew
eval "$(homebrew/bin/brew shellenv)"
brew update --force --quiet

↑ちょっと時間かかる

chmod -R go-w "$(brew --prefix)/share/zsh"

参考
https://docs.brew.sh/Installation

5nodebrewをインストール

mkdir ~/.nodebrew
mkdir ~/.nodebrew/src
brew install nodebrew

参考
https://qiita.com/kyosuke5_20/items/c5f68fc9d89b84c0df09

6nodebrewでnodeをバージョン指定してインストール

参考
https://qiita.com/kyosuke5_20/items/c5f68fc9d89b84c0df09

7 ssh接続切って インスタンスを一旦停止して再起動

これで ようやく
node -v
でnodeが動いていることを確認

8その他メモ

IPアドレスの予約で ポートを開く
foreverコマンドは別途インストールが必要

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
What you can do with signing up
0