LoginSignup
15
14

More than 5 years have passed since last update.

nodenvの使い方とか

Posted at

まえがき

いろいろ考えたが、nodenv をしばらくmacで使うことにした。
その他の候補は一応メモっとく。

セットアップ

brew doctor
brew install nodenv

基礎コマンド

$ which nodenv
/usr/local/bin/nodenv

$ nodenv help

$ nodenv version //現在のnodeのバージョン

$ nodenv versions //使用可能なnodeのリスト

環境変数

以下を bashrc に設定して、.bash_profile から読み込んだ

export PATH="$HOME/.nodenv/bin:$PATH"
eval "$(nodenv init -)"

動作確認

上記の設定を終え、ちゃんと使えるかを確認した。

node -v
npm -v

nodenv

nodenv install 10.15.0 //vはいらない

nodenv global 10.15.0 //グローバルに指定

nodenv versions
* 10.15.0 (set by /Users/abc/.nodenv/version) //現在
  8.15.0
  9.11.2

cd ~/someProj/ && nodenv local x.xx.xx //そのプロジェクトだけそのバージョン

※詳しいことはここらへんで
https://qiita.com/1000ch/items/41ea7caffe8c42c5211c
https://joppot.info/2016/10/17/3210
https://qiita.com/tonkotsuboy_com/items/5322d226b6783d25b5df
https://qiita.com/daskepon/items/e47f7ee3ade252cdf2e6
http://resistance-underground.hateblo.jp/entry/2018/04/27/123138
https://joshmorel.ca/blog/node-virtual-environments-with-nodenv/
https://github.com/nodenv/nodenv

その他の候補とか

nodebrewのインストール
https://qiita.com/takeshi81/items/805f504503cd93151ca6
https://parsetree.jp/blog/20180828/

nodebrew本体の削除
https://medium.com/@nagofox/brew-uninstall-nodebrew-8b10254c747f
https://qiita.com/tonkotsuboy_com/items/f5d17f0b9698554a7716

nvm
https://qiita.com/sansaisoba/items/242a8ba95bf70ba179d3
https://note.mu/o_matsuo/n/n748e0503fc3a

tj/n
https://github.com/tj/n

あとがき

nodenv と別に  ndenv ってのがあるがコンセプトは一緒。
だが、コミットが活発なので nodenv だったからそっちにしたけ。
とりあえず様子見。

15
14
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
15
14