葛西です。ブログを書きます。

私用メモです。葛西はニックネームです。

参考書を片手にnode.jsの勉強/node.jsをインストールした

CentOSにnode.jsをインストールするにはnvmが必要で、nvmのインストールにはcurlコマンドを使うらしい。

以下のページで「curl -o- 〜 install.sh | bash」コマンドをコピってきて、コマンドラインで実行した。

github.com

 

で、v0.12.4のnvmをインストール。

$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.6/install.sh | bash

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

                                 Dload  Upload   Total   Spent    Left  Speed

100  9321  100  9321    0     0  15800      0 --:--:-- --:--:-- --:--:-- 37890

=> Downloading nvm from git to '/home/vagrant/.nvm'

=> Initialized empty Git repository in /home/vagrant/.nvm/.git/

remote: Counting objects: 5278, done.

remote: Compressing objects: 100% (7/7), done.

remote: Total 5278 (delta 1), reused 0 (delta 0), pack-reused 5271

Receiving objects: 100% (5278/5278), 1.46 MiB | 728 KiB/s, done.

Resolving deltas: 100% (3178/3178), done.

Your version of git is out of date. Please update it!

 

=> Appending source string to /home/vagrant/.bashrc

=> Close and reopen your terminal to start using nvm or run the following to use it now:

 

export NVM_DIR="/home/vagrant/.nvm"

[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  # This loads nvm

[vagrant@localhost ~]$ nvm install v0.12.4

-bash: nvm: コマンドが見つかりません

[vagrant@localhost ~]$ exit

logout

Connection to 127.0.0.1 closed.

$ vagrant ssh

vagrant@127.0.0.1's password:

Last login: Tue Aug 30 14:38:57 2016 from 10.0.2.2

----------------------------------------------------------------

  CentOS 6.7                                  built 2015-12-01

----------------------------------------------------------------

[vagrant@localhost ~]$ nvm install v0.12.4

######################################################################## 100.0%

Now using node v0.12.4 (npm v2.10.1)

Creating default alias: default -> v0.12.4

[vagrant@localhost ~]$ nvm alias default v0.12.4

default -> v0.12.4

[vagrant@localhost ~]$ node -v

v0.12.4