DEV Community

阿豪
阿豪

Posted on

Running Node.js and Modern Web Development Tools on OpenWrt

Prerequisites and Limitations

This guide is specifically for x86 architecture only. On ARM devices, both pnpm and Node.js may fail due to libgcc_s.so.1 dependency issues.

System Configuration

First, configure your build target for musl-based systems:

ei config x86_64-unknown-linux-musl
Enter fullscreen mode Exit fullscreen mode

Installing Required Dependencies

Install libstdc++

OpenWrt's minimal environment lacks the C++ standard library:

opkg install libstdcpp
Enter fullscreen mode Exit fullscreen mode

Install Bash

OpenWrt ships with a basic sh shell, but Node.js and pnpm require bash's advanced syntax features.

Download a static bash binary from robxu9/bash-static:

ei robxu9/bash-static
Enter fullscreen mode Exit fullscreen mode

Replace the default shell symlinks:

which bash
ln -sf /root/.ei/bash /bin/sh
ln -sf /root/.ei/bash /bin/bash
Enter fullscreen mode Exit fullscreen mode

Installing Node.js

Node.js requires approximately 200MB of storage. On space-constrained OpenWrt devices, install to /tmp:

ei https://unofficial-builds.nodejs.org/download/release/v25.2.1/node-v25.2.1-linux-x64-musl.tar.xz -d /tmp
node --version
Enter fullscreen mode Exit fullscreen mode

Note: Use the unofficial-builds repository for musl-compatible binaries.

Installing Package Managers and Tools

Install pnpm

ei pnpm/pnpm
pnpm --version
Enter fullscreen mode Exit fullscreen mode

Install Git (Gitoxide)

For a lightweight Git implementation:

ei GitoxideLabs/gitoxide
gix --version
Enter fullscreen mode Exit fullscreen mode

Creating and Running a Vite Project

Now you can use modern web development tools:

# Create a new Vite project
pnpm dlx create-vite

# Navigate to your project
cd react-ts

# Start the development server (accessible from network)
pnpm run dev --host
Enter fullscreen mode Exit fullscreen mode

The --host flag exposes the dev server to your local network, allowing you to access it from other devices.

Top comments (0)