---
url: https://ws.kloudkit.com/tools/nodejs.md
description: >-
  Kloud Workspace ships Node.js with npm, pnpm and yarn, keeps global packages
  under ~/.local, and installs extra global packages when a new container
  starts.
---

# Node.js

![Node.js logo](/icons/nodejs.svg){.doc-image width=200px}

Kloud Workspace ships a Node.js toolchain that is ready to use:

* The **Node.js** runtime *(see [Tools Overview](/tools/overview) for the version)*.
* The `npm`, `pnpm` and `yarn` package managers.
* Global packages and their commands under `~/.local`, with `~/.local/bin` on `PATH`.
* Global packages installed from an environment variable when a new container starts.
* The active Node.js version in the terminal prompt.

## Additional Global Packages

When a new container starts, the workspace runs `npm install -g` for the packages listed in:

It accepts a **space-delimited** list, and each entry is a full npm spec, so you can pin a version or
install a scoped package:

```sh{2}
docker run \
  -e WS_NPM_ADDITIONAL_PACKAGES="prettier@3.2.5 @angular/cli" \
  ghcr.io/kloudkit/workspace:v0.6.2
```

A package that fails to install logs a warning, and the container keeps starting.

## Global Packages and Persistence

The workspace's `~/.npmrc` sets the npm prefix to `~/.local` and the cache to `~/.cache/npm`,
so `npm install -g` needs no `sudo` and its commands land in `~/.local/bin`.
`pnpm` follows the same layout:
its global commands go to `~/.local/bin`, its store to `~/.local/pnpm`, and `PNPM_HOME` is `~/.local/share/pnpm`.

::: warning
`/home/kloud` is not persistent, so packages you install globally by hand are lost when the container is
recreated, for example on an update.
To get them back on every new container, list them in `WS_NPM_ADDITIONAL_PACKAGES` instead.
:::

## pnpm

Shell completion for `pnpm` is ready in the terminal.
The `pnpx` alias runs `pnpm dlx`, and prints its help when you pass no arguments:

```sh
pnpx create-vite my-app
```

## npm Defaults

Every `zsh` session sets two npm variables that quiet routine output:

* **`NPM_CONFIG_FUND=false`:** hides the funding message after an install.
* **`NPM_CONFIG_UPDATE_NOTIFIER=false`:** turns off the npm update check.

Each keeps a value you set on the container, so you can turn either message back on:

```sh{2}
docker run \
  -e NPM_CONFIG_UPDATE_NOTIFIER=true \
  ghcr.io/kloudkit/workspace:v0.6.2
```

## Custom Certificates

When you add a company root CA, the workspace points `NODE_EXTRA_CA_CERTS` and `NPM_CONFIG_CAFILE` at its
certificate bundle, so `node` and `npm` in the terminal trust registries and servers signed by that CA.
See [TLS & Certificates](/settings/tls#enterprise-ca-custom-certificates) to add one.

## Prompt

The terminal prompt shows the active Node.js version *(major and minor)* in a Node.js project.
To hide it, set:

## Bun

For the Bun runtime and package manager, install the `bun` [feature](/tools/features#available-features):

```sh
ws-cli feature install bun
```
