ref:41c25716cb7b7624b3705ae4ec15db7791cb3680

build(Windows): resolve system Node.js package (#5599)

SHA: 41c25716cb7b7624b3705ae4ec15db7791cb3680
Author: Dave Lane <42013603+ReenigneArcher@users.noreply.github.com>
Date: 2026-09-03 02:06
Parents: 4d76884
3 files changed +37 -5
Type
cmake/targets/common.cmake +34 −3
@@ -50,6 +50,38 @@
#WebUI build
find_program(NPM npm REQUIRED)
if(WIN32)
get_filename_component(NPM_DIRECTORY "${NPM}" DIRECTORY)
find_program(NPM_NODE_EXECUTABLE NAMES node node.exe HINTS "${NPM_DIRECTORY}" NO_DEFAULT_PATH NO_CACHE REQUIRED)
string(CONCAT NPM_NODE_GNU_BINDING_CHECK
"process.arch === 'x64' && "
"(process.config.variables.shlib_suffix === 'dll.a' || "
"process.config.variables.node_target_type === 'shared_library')")
execute_process(
COMMAND "${NPM_NODE_EXECUTABLE}" -p "${NPM_NODE_GNU_BINDING_CHECK}"
OUTPUT_VARIABLE NPM_NODE_USES_GNU_BINDING
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NPM_NODE_USES_GNU_BINDING STREQUAL "true")
find_program(NATIVE_NPM NAMES npm.cmd npm HINTS "$ENV{ProgramFiles}/nodejs" NO_DEFAULT_PATH NO_CACHE)
if(NOT NATIVE_NPM)
message(FATAL_ERROR
"The MSYS2 Node.js package is incompatible with Rolldown. "
"Install native Windows Node.js or set NPM to its npm.cmd path.")
endif()
set(NPM "${NATIVE_NPM}" CACHE FILEPATH "Path to the npm executable" FORCE)
get_filename_component(NPM_DIRECTORY "${NPM}" DIRECTORY)
message(STATUS "MSYS2 Node.js is incompatible with Rolldown; using native npm: ${NPM}")
endif()
set(NPM_COMMAND cmd /C)
set(NPM_PATH "PATH=${NPM_DIRECTORY};$ENV{PATH}")
else()
set(NPM_COMMAND)
set(NPM_PATH "PATH=$ENV{PATH}")
endif()
set(NPM_INSTALL_FLAGS "--ignore-scripts")
if (NPM_OFFLINE)
set(NPM_INSTALL_FLAGS "${NPM_INSTALL_FLAGS} --offline")
@@ -58,9 +90,8 @@
add_custom_target(web-ui ALL
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
COMMENT "Installing NPM Dependencies and Building the Web UI"
COMMAND "${CMAKE_COMMAND}" -E env "${NPM_PATH}" ${NPM_COMMAND} "${NPM}" ci ${NPM_INSTALL_FLAGS}
COMMAND "$<$<BOOL:${WIN32}>:cmd;/C>" "${NPM}" ci ${NPM_INSTALL_FLAGS}
COMMAND "${CMAKE_COMMAND}" -E env "SUNSHINE_BUILD_HOMEBREW=${NPM_BUILD_HOMEBREW}" "SUNSHINE_SOURCE_ASSETS_DIR=${NPM_SOURCE_ASSETS_DIR}" "SUNSHINE_ASSETS_DIR=${NPM_ASSETS_DIR}" "$<$<BOOL:${WIN32}>:cmd;/C>" "${NPM}" run build # cmake-lint: disable=C0301
COMMAND_EXPAND_LISTS
COMMAND "${CMAKE_COMMAND}" -E env "${NPM_PATH}" "SUNSHINE_BUILD_HOMEBREW=${NPM_BUILD_HOMEBREW}" "SUNSHINE_SOURCE_ASSETS_DIR=${NPM_SOURCE_ASSETS_DIR}" "SUNSHINE_ASSETS_DIR=${NPM_ASSETS_DIR}" ${NPM_COMMAND} "${NPM}" run build # cmake-lint: disable=C0301
VERBATIM)
# docs
docs/building.md +2 −2
@@ -182,7 +182,6 @@
if [[ "${MSYSTEM}" == "UCRT64" ]]; then
dependencies+=(
"mingw-w64-${TOOLCHAIN}-MinHook"
"mingw-w64-${TOOLCHAIN}-nodejs"
"mingw-w64-${TOOLCHAIN}-nsis"
)
fi
@@ -199,7 +198,8 @@
To create a WiX installer, you also need to install [.NET](https://dotnet.microsoft.com/download).
For ARM64: To build frontend, you also need to install [Node.JS](https://nodejs.org/en/download)
To build the frontend, install native [Node.js](https://nodejs.org/en/download) for the target architecture. The
MSYS2 Node.js package is not supported because its shared runtime cannot load the native binding required by Rolldown.
### Clone
Ensure [git](https://git-scm.com) is installed on your system, then clone the repository using the following command:
src/nvhttp.cpp +1 −0
@@ -1510,6 +1510,7 @@
enabled device and "name" is the friendly client name set during pairing.
*/
std::pair<bool, std::string> get_client_status(const std::string_view cert_pem);
void start() {
platf::set_thread_name("nvhttp");
auto shutdown_event = mail::man->event<bool>(mail::shutdown);