Install nodenv on Ubuntu · GitHub

PHOTO EMBED

Fri Mar 05 2021 21:30:08 GMT+0000 (Coordinated Universal Time)

Saved by @faisalhumayun

# install the base app
git clone https://github.com/nodenv/nodenv.git ~/.nodenv

# add nodenv to system wide bin dir to allow executing it everywhere
sudo ln -vs ~/.nodenv/bin/nodenv /usr/local/bin/nodenv

# compile dynamic bash extension to speed up nodenv - this can safely fail
cd ~/.nodenv
src/configure && make -C src || true
cd ~/

# install plugins
mkdir -p "$(nodenv root)"/plugins
git clone https://github.com/nodenv/node-build.git "$(nodenv root)"/plugins/node-build
git clone https://github.com/nodenv/nodenv-aliases.git $(nodenv root)/plugins/nodenv-aliases

# install a node version to bootstrap shims
nodenv install 14.7.0
nodenv global 14

# make shims available system wide
sudo ln -vs $HOME/.nodenv/shims/* /usr/local/bin/

# make sure everything is working
node --version
npm --version
npx --version
content_copyCOPY

https://gist.dreamtobe.cn/mrbar42/faa10a68e32a40c2363aed5e150d68da