Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // To install
- version=$(curl -Ls https://nodejs.org/dist | grep -ioP 'v\d\d?\.\d\d?\.\d\d?' | sort -rV | head -n 1)
- wget https://nodejs.org/dist/$version/node-$version-linux-x64.tar.xz
- unxz node-$version-linux-x64.tar.xz
- tar xvf node-$version-linux-x64.tar
- rm node-$version-linux-x64.tar
- mkdir /usr/local/node
- mv node-$version-linux-x64 /usr/local/node/$version
- ln -fs /usr/local/node/$version/bin/* /usr/bin
- # For Yarn
- corepack enable
- # For Bun (https://bun.sh)
- curl -fsSL https://bun.sh/install | bash
- node -v
- # To reregister standart Node version
- for bin in $(ls /usr/local/node/$version/bin); do
- ln -fs /usr/local/node/$version/bin/$bin /usr/bin/$bin
- done
- // To uninstall
- # Add $version for a specific version
- rm -r /usr/local/node
- for bin in $(ls /usr/local/node/$version/bin); do
- rm /usr/bin/$bin
- done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement