Skip to content

Linux Node.js Guide

Mattscreative edited this page Dec 5, 2025 · 2 revisions

Linux Node.js Guide

Complete beginner-friendly guide to Node.js on Linux, covering Arch Linux, CachyOS, and other distributions including installation, npm, and JavaScript development.


Table of Contents

  1. Node.js Installation
  2. npm Package Management
  3. Node.js Development
  4. Troubleshooting

Node.js Installation

Install Node.js

Arch/CachyOS:

# Install Node.js
sudo pacman -S nodejs npm

# Or use nvm (Node Version Manager)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash

Debian/Ubuntu:

sudo apt install nodejs npm

Fedora:

sudo dnf install nodejs npm

Verify Installation

Check Node.js:

# Check version
node --version
npm --version

npm Package Management

Install Packages

Using npm:

# Install package
npm install package-name

# Install globally
npm install -g package-name

# Install from package.json
npm install

npm Configuration

Configure npm:

# Set registry
npm config set registry https://registry.npmjs.org/

# List packages
npm list

# Update packages
npm update

Node.js Development

Create Project

Initialize project:

# Create project
npm init

# Or with defaults
npm init -y

Run Scripts

Execute scripts:

# Run script
npm run script-name

# Start application
npm start

# Run tests
npm test

Troubleshooting

Node.js Not Found

Check installation:

# Check Node.js
which node
which npm

# Install if missing
sudo pacman -S nodejs npm

Permission Errors

Fix permissions:

# Use nvm (recommended)
# Or configure npm prefix
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'

Summary

This guide covered Node.js installation, npm usage, and development setup for Arch Linux, CachyOS, and other distributions.


Next Steps


This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.

Clone this wiki locally