ITeye博客

NodeJS ENV Similar to JENV and PyENV

sillycat · 2020-02-25 05:14 · Summary · Scripts · Web前端 · Markdown

NodeJS ENV Similar to JENV and PyENV

It seems these 2 are good. https://github.com/nodenv/nodenv https://github.com/nvm-sh/nvm

Let me try nodenv, it seems more similar to JENV and PyENV. https://blog.daskepon.com/install-nodejs-with-nodenv-on-macos/

Install the tool nodenv

git clone https://github.com/nodenv/nodenv.git ~/.nodenv cd ~/.nodenv/ src/configure make -C src

On MAC

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

. ~/.profile

Install node-build

git clone https://github.com/nodenv/node-build.git $(nodenv root)/plugins/node-build

Check version

nodenv --version nodenv 1.3.1+11.5024679

List all versions

nodenv versions

  • system => node-v12.14.1 (set by /Users/hluo/.nodenv/version)

List the version I can install

nodenv install -l

Install an old version and a new version

nodenv install 8.17.0 nodenv install 12.14.1

Choose the current directory to using 8.17.0

nodenv local 8.17.0

Choose global to use 12.14.1

nodenv global 12.14.1

It is pretty well

nodenv versions system

  • 8.17.0 (set by /Users/hluo/.nodenv/.node-version) 12.14.1 12.16.1

Try the sample things on Ubuntu and CentOS7 On Ubuntu Install the tool nodenv

git clone https://github.com/nodenv/nodenv.git ~/.nodenv cd ~/.nodenv/ src/configure make -C src

vi ~/.profile PATH="$HOME/.nodenv/bin:$PATH" eval "$(nodenv init -)"

. ~/.profile

Install node-build

git clone https://github.com/nodenv/node-build.git $(nodenv root)/plugins/node-build

Check version

nodenv --version nodenv 1.3.1+11.5024679

Install and try

nodenv install -l | grep 8. nodenv install 8.17.0 nodenv install 12.16.1 nodenv global 12.16.1

node --version v12.16.1

nodenv versions 8.17.0

  • 12.16.1 (set by /home/carl/.nodenv/version)

On CentOS7 Install the tool nodenv

git clone https://github.com/nodenv/nodenv.git ~/.nodenv cd ~/.nodenv/ src/configure make -C src

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

. ~/.bash_profile

Install node-build

git clone https://github.com/nodenv/node-build.git $(nodenv root)/plugins/node-build

Check version

nodenv --version nodenv 1.3.1+11.5024679

Install and try

nodenv install -l | grep 8. nodenv install 8.17.0 nodenv install 12.16.1 nodenv global 12.16.1

node --version v12.16.1

nodenv versions 8.17.0

  • 12.16.1 (set by /home/carl/.nodenv/version)

References: https://www.jianshu.com/p/e21e3783304f

https://github.com/thenativeweb/nodeenv https://github.com/DJMcK/nodenv https://github.com/nvm-sh/nvm https://github.com/nodenv/nodenv

https://wiz.gitbooks.io/developer-book/nodenv_setup.html https://www.kutu66.com/GitHub/article_132253 https://blog.daskepon.com/install-nodejs-with-nodenv-on-macos/

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。