From 8cf17e38266ffa1272a5428d8aab4f579594934d Mon Sep 17 00:00:00 2001 From: Nils Goroll Date: Tue, 13 Jan 2026 16:34:27 +0100 Subject: [PATCH] chore: Teach Makefile to handle node pre-release versions (#10790) Using node head built from source, "make frontend" failed with this confusing message: ``` $ make node-check /bin/sh: 1: printf: 0-pre: not completely converted Forgejo requires Node.js 20.0.0 or greater and npm to build. You can get it at https://nodejs.org/en/download/ make: *** [Makefile:327: node-check] Error 1 ``` The reason is that from this output ``` $ node -v v26.0.0-pre ``` `0-pre` could not be converted to the printf `"%d"` format. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/10790 Reviewed-by: Mathieu Fenniak Reviewed-by: Gusted Co-authored-by: Nils Goroll Co-committed-by: Nils Goroll --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7a4f235c1f..a86e5727dd 100644 --- a/Makefile +++ b/Makefile @@ -322,7 +322,7 @@ git-check: node-check: $(eval MIN_NODE_VERSION_STR := $(shell grep -Eo '"node":.*[0-9.]+"' package.json | sed -n 's/.*[^0-9.]\([0-9.]*\)"/\1/p')) $(eval MIN_NODE_VERSION := $(shell printf "%03d%03d%03d" $(shell echo '$(MIN_NODE_VERSION_STR)' | tr '.' ' '))) - $(eval NODE_VERSION := $(shell printf "%03d%03d%03d" $(shell node -v | cut -c2- | tr '.' ' ');)) + $(eval NODE_VERSION := $(shell printf "%03d%03d%03d" $(shell node -v | cut -c2- | sed 's:-.*::' | tr '.' ' ');)) $(eval NPM_MISSING := $(shell hash npm > /dev/null 2>&1 || echo 1)) @if [ "$(NODE_VERSION)" -lt "$(MIN_NODE_VERSION)" -o "$(NPM_MISSING)" = "1" ]; then \ echo "Forgejo requires Node.js $(MIN_NODE_VERSION_STR) or greater and npm to build. You can get it at https://nodejs.org/en/download/"; \