English | 简体中文
This project compiles Node.js for the OpenHarmony platform and releases pre-built packages.
Head to the releases page to download.
1. On an OpenHarmony PC
Download the tarball with curl in the “Terminal” (HiShell), then extract it and add the bin directory to PATH.
cd ~
curl -L -O https://github.com/hqzing/ohos-node/releases/download/v24.2.0/node-v24.2.0-openharmony-arm64.tar.gz
tar -zxf node-v24.2.0-openharmony-arm64.tar.gz
export PATH=$PATH:~/node-v24.2.0-openharmony-arm64/bin
alias node="node --jitless"
# You can now use the 'node' command.Note: although current OpenHarmony PCs can execute self-signed binaries directly, this approach still has major restrictions.
The two most common ones:
- Self-signed binaries lack JIT permission, so node must be started in JIT-less mode.
- They are granted no SELinux privileges, so you may hit various permission issues.
If these limits are unacceptable, consider:
- Repackaging the tar into an hnp. For details, please refer to solution of DevBox.
- Installing CodeArts IDE from the AppGallery, it ships its own Node.js runtime.
2. On an OpenHarmony Dev-Board
Push the tarball to the device with hdc, extract, and update PATH.
Example:
hdc file send node-v24.2.0-openharmony-arm64.tar.gz /data
hdc shell
cd /data
tar -zxf node-v24.2.0-openharmony-arm64.tar.gz
export PATH=$PATH:/data/node-v24.2.0-openharmony-arm64/bin
# You can now use the 'node' command.3. Inside the OpenHarmony Container
Download the tarball with curl inside the container, extract, and add to PATH.
Example:
docker run -itd --name=ohos ghcr.io/hqzing/docker-mini-openharmony:latest
docker exec -it ohos sh
cd /root
curl -L -O https://github.com/hqzing/ohos-node/releases/download/v24.2.0/node-v24.2.0-openharmony-arm64.tar.gz
tar -zxf node-v24.2.0-openharmony-arm64.tar.gz -C /opt
export PATH=$PATH:/opt/node-v24.2.0-openharmony-arm64/bin
# You can now use the 'node' command.1. Manual Build
You need a Linux x64 host to cross-compile Node.js with the supplied build.sh.
Example on Ubuntu 24.04 x64:
sudo apt update && sudo apt install -y build-essential unzip jq
./build.sh v24.2.02. CI Build
If you are familiar with GitHub Actions, reuse the workflow file in this repo to build on GitHub’s runners, and no local environment required.
Steps for your own builds:
- Fork this repo.
- Enable workflow under the “Actions” tab.
- Push commits or create a release to trigger the workflow.