MANUAL

Node.js and JavaScript

01 / WHAT IT IS

JavaScript on your computer.

JavaScript is the language that runs in your browser. With Node.js, JavaScript also runs on your computer. Almost every modern website uses Node.js to prepare files for the browser. With Node.js, you also get npm, the programme you use to install packages.

Always choose an LTS version. LTS means that version will receive updates for a long time.

01 / Windows

Open PowerShell via the Start menu and run the following:

winget install --id OpenJS.NodeJS.LTS -e

Close PowerShell and open it again. Check:

node --version
npm --version

02 / LINUX

Installing with nvm.

The version of Node.js in Ubuntu and Debian is often too old. That’s why, on Linux, you should first install nvm, a programme that manages the correct version of Node.js for you.

02 / Installing nvm

Go to github.com/nvm-sh/nvm and copy the installation command under Installing and Updating. It looks like this (the version number may be different):

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash

Close the terminal and open it again.

03 / Installing Node.js

nvm install --lts
node --version

04 / Fedora and Arch

In that case, the version from the system’s own package manager is usually recent enough.

Fedora

sudo dnf install nodejs

Arch Linux

sudo pacman -S nodejs npm

03 / A PROJECT

Installing packages.

05 / package.json

There is usually a file called package.json in your project folder. This file lists the packages your app requires.

06 / Install everything

Open the terminal in your project folder:

npm install

npm creates a folder called node_modules. It’s large and shouldn’t be included in Git.

07 / Launching the app

The available commands are listed in package.json under scripts. Usually, they are:

npm run dev

You will then see an address such as http://localhost:5173.. Open that in your browser. To stop it, press Ctrl + C.

08 / Building for the live site

npm run build

04 / WORKING WITH AI

Ask your assistant.

09 / A task for your AI assistant

"Check which version of Node.js this project requires, install the packages and run the app locally. Ask for permission before adding new packages."

10 / TypeScript

Do you see any files ending in .ts? That’s TypeScript: JavaScript with extra checks for typing errors. You don’t need to install anything separately; npm install takes care of that.

Good to know

Add node_modules/ to the .gitignore file. Don’t just add packages suggested by your AI assistant. First, ask what the package does and whether it is being maintained.