최신 Node.js 설치 및 사용
$
로 시작하는 줄은, 한줄 한줄 복사해서 터미널에서 실행해주셔야합니다.- 터미널을 재시작 하여야 할 수도 있습니다.
- 재시작 후, 현재 작업하는 폴더로 다시 이동해주셔야합니다.
$
로 시작하는 줄은, 한줄 한줄 복사해서 터미널에서 실행해주셔야합니다.$ git clone https://github.com/riywo/anyenv ~/.anyenv
$ echo 'export PATH="$HOME/.anyenv/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(anyenv init -)"' >> ~/.bash_profile
$ anyenv install ndenv
$ cat .node-version
v6.2.0
$ node --version
v6.2.0
$ npm | tail -1
npm@3.8.6 /Users/_/.anyenv/envs/ndenv/versions/v6.2.0/lib/node_modules/npm
$ ndenv local v6.2.0
를 사용해야 합니다.이 프로젝트에서 사용하는 환경변수는 .env파일에 보관되어 있습니다. autoenv는 이를 자동으로 불러와 줍니다.
$ git clone git://github.com/kennethreitz/autoenv.git ~/.autoenv
$ echo 'source ~/.autoenv/activate.sh' >> ~/.bash_profile
(brew로도 설치할 수 있습니다.)
bc1
폴더로 들어갈 때, 다음과 같은 확인 메세지가 뜨며,autoenv:
autoenv: WARNING:
autoenv: This is the first time you are about to source /Users/_/projects/node_workspace/bc1/.env:
autoenv:
autoenv: --- (begin contents) ---------------------------------------
autoenv: if [[ ! -d $PROJECT_PATH_BC1 ]]; then$
autoenv: export PROJECT_PATH_BC1="`pwd`"$
autoenv: export NODE_PATH="$PROJECT_PATH_BC1/node_modules"$
autoenv: export PATH="$NODE_PATH/.bin:$PATH"$
autoenv: fi$
autoenv:
autoenv: --- (end contents) -----------------------------------------
autoenv:
autoenv: Are you sure you want to allow this? (y/N)
y
를 입력하여 넘어갑니다.