From cabe6a0516aecc3b2af1b8e85fc545a96304c4ac Mon Sep 17 00:00:00 2001 From: Ron Lauren Hombre <118486316+ronhombre@users.noreply.github.com> Date: Sun, 17 May 2026 02:52:28 +0800 Subject: [PATCH 1/4] Refine pnpm setup in install.sh Updated pnpm setup to use version from package.json and enable corepack by default --- install.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 91b29c8..25f1d23 100755 --- a/install.sh +++ b/install.sh @@ -91,8 +91,9 @@ grep -Rl /usr/src | xargs -n1 sed -i -e "s@/usr/src@$IMMICH_PATH@g" mkdir -p $IMMICH_PATH/cache grep -RlE "\"/build\"|'/build'" | xargs -n1 sed -i -e "s@\"/build\"@\"$APP\"@g" -e "s@'/build'@'$APP'@g" -# Setup pnpm -corepack use pnpm@latest +# Setup pnpm and use the version specified in package.json packageManager. This avoids incompatibility errors with newer pnpm releases +corepack enable +pnpm install # Install extism/js-pdk for extism-js curl -O https://raw.githubusercontent.com/extism/js-pdk/main/install.sh From ca84a7367e0ee783465a55a0c3748550f2424b08 Mon Sep 17 00:00:00 2001 From: Ron Lauren Hombre <118486316+ronhombre@users.noreply.github.com> Date: Sun, 17 May 2026 03:10:14 +0800 Subject: [PATCH 2/4] Run `pnpm store prune` earlier Prevents corepack from trying to install the latest pnpm version by running `pnpm store prune` where the package.json is located so it knows what pnpm version it should use. --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 25f1d23..d26fd0a 100755 --- a/install.sh +++ b/install.sh @@ -135,8 +135,8 @@ cp -a plugins/dist $APP/corePlugin/ cp -a plugins/manifest.json $APP/corePlugin/ cp -a LICENSE $APP/ cp -a i18n $APP/../ -cd $APP pnpm store prune +cd $APP cd - # immich-machine-learning From e15163f62b513cf6dcc7a89a65913463e286fbe2 Mon Sep 17 00:00:00 2001 From: Ron Lauren Hombre <118486316+ronhombre@users.noreply.github.com> Date: Sun, 17 May 2026 04:04:44 +0800 Subject: [PATCH 3/4] Inject packageManager from monorepo's package.json Add script to copy packageManager field from source package.json to destination. This executes node.js directly in the script. This is spicy and is a workaround. Otherwise, the build fails again when corepack tries to install the latest pnpm --- install.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/install.sh b/install.sh index d26fd0a..1734fd8 100755 --- a/install.sh +++ b/install.sh @@ -175,6 +175,25 @@ rm cities500.zip # Install sharp cd $APP + +# Copy the packageManager field from the monorepo package.json onto the $APP package.json +# We are specifically passing the value as an argument to reduce any attack surface +# Please replace this as soon as you find a suitable solution +node -e " +const fs = require('fs'); +const sourcePath = process.argv[1]; +const sourcePkg = JSON.parse(fs.readFileSync(sourcePath, 'utf8')); +const destPkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); + +if (sourcePkg.packageManager) { + destPkg.packageManager = sourcePkg.packageManager; + fs.writeFileSync('package.json', JSON.stringify(destPkg, null, 2) + '\n'); + console.log('Successfully injected packageManager:', sourcePkg.packageManager); +} else { + console.error('Error: packageManager field not found in source package.json'); + process.exit(1); +} +" "$TMP/package.json" # https://github.com/lovell/sharp/blob/main/src/common.h#L20 VIPS_LOCAL_VERSION="$(pkg-config --modversion vips || true)" VIPS_TARGET_VERSION="8.17.3" From 740262eaa2b79646732dd5beda66f42b8199d39b Mon Sep 17 00:00:00 2001 From: Ron Lauren Hombre <118486316+ronhombre@users.noreply.github.com> Date: Sun, 17 May 2026 04:08:48 +0800 Subject: [PATCH 4/4] Simplify packageManager injection using jq Replaced Node.js script with jq command to copy packageManager field from source package.json to destination. --- install.sh | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/install.sh b/install.sh index 1734fd8..7a0c579 100755 --- a/install.sh +++ b/install.sh @@ -177,23 +177,7 @@ rm cities500.zip cd $APP # Copy the packageManager field from the monorepo package.json onto the $APP package.json -# We are specifically passing the value as an argument to reduce any attack surface -# Please replace this as soon as you find a suitable solution -node -e " -const fs = require('fs'); -const sourcePath = process.argv[1]; -const sourcePkg = JSON.parse(fs.readFileSync(sourcePath, 'utf8')); -const destPkg = JSON.parse(fs.readFileSync('package.json', 'utf8')); - -if (sourcePkg.packageManager) { - destPkg.packageManager = sourcePkg.packageManager; - fs.writeFileSync('package.json', JSON.stringify(destPkg, null, 2) + '\n'); - console.log('Successfully injected packageManager:', sourcePkg.packageManager); -} else { - console.error('Error: packageManager field not found in source package.json'); - process.exit(1); -} -" "$TMP/package.json" +jq --argfile source "$TMP/package.json" '.packageManager = $source.packageManager' package.json > tmp.json && mv tmp.json package.json # https://github.com/lovell/sharp/blob/main/src/common.h#L20 VIPS_LOCAL_VERSION="$(pkg-config --modversion vips || true)" VIPS_TARGET_VERSION="8.17.3"