Skip to content

Instantly share code, notes, and snippets.

@chapimenge3
Created February 11, 2024 12:19
Show Gist options
  • Save chapimenge3/43f2337388a3abfced4639a53477e426 to your computer and use it in GitHub Desktop.
Save chapimenge3/43f2337388a3abfced4639a53477e426 to your computer and use it in GitHub Desktop.
Useful Scripts for installing softwares on ubuntu.

NodeJs

Requirements

sudo apt-get install software-properties-common

Upgrade

if you are upgrading remove the current installation first

sudo apt-get remove nodejs
sudo apt-get purge nodejs
sudo apt-get autoremove

then follow the below install instruction.

Install

change NODE_MAJOR to the version you want to install

sudo apt-get update && sudo apt-get install -y ca-certificates curl gnupg
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
NODE_MAJOR=20
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list
sudo apt-get update && sudo apt-get install nodejs -y

Common issues

Error: The repository 'x' nodejs jammy Release' does not have a Release file.

Solution: most probably you are using some personal apt source so check which file is causing the issue from /etc/apt/source.list.d/. check them one by one and try to remove the file and use the above nodejs source as we can rely on them to install. you can even delete nodesource.list as the above echo commd will create it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment