👏

[deploy] nodejsを使えるようにする

2021/10/01に公開

nodebrewインストール

[root@ip-10-0-0-10 bin]# curl -L git.io/nodebrew | perl - setup
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0
100 24696  100 24696    0     0  22069      0  0:00:01  0:00:01 --:--:-- 22069
Fetching nodebrew...
Installed nodebrew in $HOME/.nodebrew

========================================
Export a path to nodebrew:

export PATH=$HOME/.nodebrew/current/bin:$PATH
========================================
[root@ip-10-0-0-10 bin]#

パスを通す

[root@ip-10-0-0-10 ~]# export PATH=$HOME/.nodebrew/current/bin:$PATH

ログイン時にシェルに読み込ませる

[root@ip-10-0-0-10 sound-matching-front]# cat ~/.bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
	. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin
export PATH=$HOME/.nodebrew/current/bin:$PATH

export PATH
[root@ip-10-0-0-10 sound-matching-front]# 

node.jsインストール

[root@ip-10-0-0-10 ~]# nodebrew install-binary v0.10.12

currentを指定

nodebrew ls
v0.10.12

current: none
[root@ip-10-0-0-10 sound-matching-front]# nodebrew use v16.10.0
use v16.10.0 //安定ばんのv16.10.0を指定

Discussion