Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions apps/memos-local-plugin/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,9 @@ function Prepare-StagedPackage {
Remove-Item -Recurse -Force $StagedPrefix -ErrorAction SilentlyContinue
throw "Node.js executable not found for staged install"
}
& $NodeForBridge -e 'if (Number(process.versions.node.split(".")[0]) < 22) { console.error("MemOS requires Node.js >=22 in the bridge runtime"); process.exit(1); }'
# Avoid nested quote loss when Windows PowerShell serializes native command
# arguments. String.fromCharCode keeps the JS expression quote-free.
& $NodeForBridge -e 'process.exit(Number(process.versions.node.split(String.fromCharCode(46))[0]) < 22 ? 1 : 0)'
if ($LASTEXITCODE -ne 0) { Remove-Item -Recurse -Force $StagedPrefix; throw "Bridge Node.js runtime is unsupported; existing installation is unchanged." }

$NpmCommand = (Get-Command "npm.cmd" -ErrorAction SilentlyContinue).Source
Expand All @@ -355,8 +357,10 @@ function Prepare-StagedPackage {
}

try {
Invoke-NativeChecked -Command "tar" -Arguments @(
"xzf", $BuiltTarball, "-C", $StagedPrefix, "--strip-components=1"
$WindowsTar = Join-Path $env:SystemRoot "System32\tar.exe"
if (-not (Test-Path $WindowsTar)) { throw "Windows tar.exe not found" }
Invoke-NativeChecked -Command $WindowsTar -Arguments @(
"-xzf", $BuiltTarball, "-C", $StagedPrefix, "--strip-components=1"
) -FailureMessage "Package extraction failed"
if (-not (Test-Path (Join-Path $StagedPrefix "package.json"))) {
throw "Package extraction failed: package.json missing"
Expand Down Expand Up @@ -385,7 +389,8 @@ function Prepare-StagedPackage {
throw "better-sqlite3 is not loadable: SQLite prebuilt failed its staging smoke test. No source rebuild was attempted; existing installation is unchanged."
}

Set-Content -Path (Join-Path $StagedPrefix ".memos-node-bin") -Value $NodeForBridge -Encoding UTF8
$NodeMarkerPath = Join-Path $StagedPrefix ".memos-node-bin"
[IO.File]::WriteAllText($NodeMarkerPath, "$NodeForBridge`n", (New-Object System.Text.UTF8Encoding $false))
return $StagedPrefix
} catch {
Remove-Item -Recurse -Force $StagedPrefix -ErrorAction SilentlyContinue
Expand Down
Loading