Here's a complete markdown file for installing Rust, Python, and JavaScript/TypeScript (Node.js) on your Ubuntu-based POP OS system:
After restoring my system and starting fresh with POP OS, here's a quick guide for setting up essential development tools: Rust, Python, and Node.js.
Start by updating and upgrading your system packages:
sudo apt update && sudo apt upgrade
To install Rust, use the following command:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
After installation, add Rust to your system's PATH (usually added automatically by the installer):
source $HOME/.cargo/env
Verify the installation:
rustc --version
Node.js (which includes the Node Package Manager, or NPM) is essential for JavaScript/TypeScript development. First, install the Node.js package:
sudo apt install -y nodejs npm
Confirm installation of Node.js and NPM:
node -v
npm -v
To install TypeScript globally, run:
npm install -g typescript
Verify TypeScript installation:
tsc -v
Most Ubuntu systems come with Python 3 pre-installed, but you can ensure it’s installed and up-to-date with:
sudo apt install -y python3 python3-pip
Verify the installations:
python3 --version
pip3 --version
You may want to install essential Python tools, like virtualenv
for isolated environments:
pip3 install virtualenv
Ensure all installations are successful:
rustc --version
node -v
npm -v
tsc -v
python3 --version
pip3 --version
You're now set up with Rust, Node.js, and Python, ready to dive into your projects!
Fixing Errors
This error is caused by two issues:
-
Node.js Version Incompatibility
Thetypescript@5.7.2
package requires Node.js version>=14.17
, but your system currently has Node.js version12.22.9
. This version is outdated and doesn't meet the requirements for TypeScript. -
Permission Denied (EACCES)
Thenpm install -g
command attempts to install globally into/usr/local/lib/node_modules
, but your user account does not have sufficient permissions to write to this directory.
TypeScript requires Node.js >=14.17
. Use one of the following methods to update:
-
Using Node Version Manager (NVM): If you don't already have NVM installed, install it first:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
Then, restart your terminal and install a newer version of Node.js:
nvm install --lts nvm use --lts node -v # Verify the version is >=14.17
-
From the Node.js Official Website: Download and install the latest LTS version of Node.js from nodejs.org.
You have two main options to resolve the EACCES
error.
-
Option A: Use a Local
npm
Directory: Configure npm to use a directory within your user folder for global installations:mkdir -p ~/.npm-global npm config set prefix '~/.npm-global'
Add this directory to your PATH by adding the following line to your shell configuration file (
~/.bashrc
,~/.zshrc
, or~/.profile
):export PATH=~/.npm-global/bin:$PATH
Reload the shell configuration:
source ~/.bashrc # or source ~/.zshrc
Then try the install again:
npm install -g typescript
-
Option B: Use
sudo
(not recommended): Run the installation command withsudo
to grant administrative privileges:sudo npm install -g typescript
Be cautious with this approach as it can lead to permission issues when mixing
sudo
and non-sudo
npm operations.
Once Node.js is updated and permissions are fixed, install TypeScript:
npm install -g typescript
Confirm that TypeScript is installed and accessible:
tsc --version
If you still encounter issues, share the updated error logs for further debugging.