title | parent | grand_parent | nav_exclude | has_toc | layout | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Install / Update / Uninstall Node.js + NPM |
+ System |
Bonus Section |
true |
false |
|
Node.js is an open-source, cross-platform JavaScript runtime environment. Node.js includes NPM in the installation package as well.
{% hint style="success" %} Difficulty: Easy {% endhint %}
- With user
admin
, update the packages and upgrade to keep up to date with the OS, press "y" and "enter" when needed
sudo apt update && sudo apt full-upgrade
- Change to a temporary directory which is cleared on reboot
cd /tmp
- Set the environment variable of the version
VERSION=22
- We will use the NodeSource Node.js Binary Distributions repository instructions. Download the setup script
{% code overflow="wrap" %}
curl -fsSL https://deb.nodesource.com/setup_$VERSION.x -o nodesource_setup.sh
{% endcode %}
- Run the setup script
sudo -E bash nodesource_setup.sh
- Update the package manager and install Node.js + NPM
sudo apt update && sudo apt install nodejs
- Check the correct installation of nodejs
node -v
Example of expected output:
v18.16.0
- Check the correct installation of NPM
npm -v
Example of expected output:
9.5.1
- (Optional) Delete the setup script
rm nodesource_setup.sh
- With user
admin
, stop the current dependencies services of the Node + NPM, that are actually BTC RPC Explorer + Thunderhub
sudo systemctl stop btcrpcexplorer && sudo systemctl stop thunderhub
- To upgrade type this command
sudo apt update && sudo apt full-upgrade
- Check the correct installation to the latest release
node -v && npm -v
- Start BTC RPC Explorer & Thunderhub again
sudo systemctl start btcrpcexplorer && sudo systemctl start thunderhub
- To uninstall type this command and press "y" and "enter" when needed
{% code overflow="wrap" %}
sudo apt purge nodejs && sudo rm -r /etc/apt/sources.list.d/nodesource.list
{% endcode %}