Developing Web Apps in Fedora Silverblue

Last updated on

  • Linux
  • Fedora Silverblue
  • Node.js

Setting up Node.js

First we'll create a toolbox called node.

Toolboxes are a feature in fedora silverblue to run software in isolation, you can setup an entire dev environment in a toolbox and not have any of the software be a part of your main OS.

toolbox create -c node

Next, we'll install a Node Version Mananger.

I like n because it keeps things simple, no subshells, profile setup, or convoluted APIs.

curl -L -o n
bash n lts
rm n

We've just installed the LTS version of Node.js using n, but before we're finished, we'll need to add node to our path and have n install newer node versions locally.

open up your .bashrc and add this line.

# if $HOME/.n/bin is not in our path, set it
if ! [[ "$PATH" =~ "$HOME/.n/bin" ]]; then

# if N_PREFIX is not defined, set it
if [[ ! -v N_PREFIX ]]; then

  export N_PREFIX

if you type node -v now you should see a version number print out.

we'll install n as a npm package now, so we can update it periodically from npm.

npm install -g n

For Node.js to do file watching we need to bump up fs.inotify.max_user_watches. Without it, we might see errors like

Error: ENOSPC: System limit for number of file watchers reached
sudo sysctl fs.inotify.max_user_watches=524288
sudo sysctl -p --system

VSCode Related setup

first, create ~/.local/bin/vscode-podman and paste the contents below.

#!/usr/bin/env sh
exec flatpak-spawn --host podman "[email protected]"

Next, Go to VSCode settings, to the Remote-Containers section, and update the remote.containers.dockerPath with the absolute path to our script.

IMPORTANT It must be the absolute path, e.g. /var/home/<user>/.local/bin/vscode-podman

The next steps will setup VSCode Container settings.

You can either run the script below to setup a toolbox called "node" if your container is named something else, go ahead and put it where "node" is in this command.

wget -O - -o /dev/null "" | bash -s node

if you're uncomfortable with running scripts from the internet, that's fine, and I'll now explain everything that happens here.

#!/usr/bin/env bash

# we check to see that "node" was sent in to the script
# otherwise we print a helpful message to tell you how to use it
if [ -n "$1" ]; then
  # we create a toolbox, if its already created this is a no-op

  toolbox create "$1" >/dev/null 2>&1
  # we then add a JSON file to let the flatpak version of VSCode
  # know about the toolbox we've created.
  wget -O - -o /dev/null " >> ~/.var/app/com.visualstudio.code/config/Code/User/globalStorage/ms-vscode-remote.remote-containers/nameConfigs/$1.json"

  # in order to allow VSCode to install runtime dependencies we need to
  # change permissions to the toolbox folders
  toolbox run -c "$1" sudo chmod 755 /root && sudo mkdir -p -m0777 /root/.vscode-server >/dev/null 2>&1

  # we're done!
  echo "All done, now run Remote-Containers: Attach to Running Container... from VSCode"
  echo "Usage: $0 [TOOLBOX_NAME]"

Hope you enjoyed the read, if you have any questions, feel free to reach out to me on twitter @lifeiscontent