在Windows上的特定目录上无人值守安装PostgreSQL失败

时间:2019-05-24 20:59:01

标签: postgresql command-line windows-10 postgresql-11

我需要在Windows 10上以无人参与模式在NSIS上安装Postgresql 11.3,为此,我使用EnterpriseDB安装程序(https://www.enterprisedb.com/downloads/postgres-postgresql-downloads),但失败并显示错误消息“ error.install.directory.nondefault”。此nsis脚本可与PosgreSQL 9.3 Windows安装程序配合使用。

以下简单的安装脚本在我的开发PC上不起作用,但在其他PC上也可以起作用:

;--------------------------------
; The name of the installer
Name "PostgreSQL 11 Installer"

; The file to write
OutFile "PostgreSQL11Installer.exe"

; Request application privileges
RequestExecutionLevel admin

;--------------------------------

;PostgreSQL Installation
Section "" 
  ExecWait 'C:\tmp\postgresql-11.3-1-windows-x64.exe  --unattendedmodeui minimal --mode unattended  --prefix C:\PostgreSQL11 --datadir C:\PostgreSQL11\data --serverport 5432 --superpassword mypassword'
SectionEnd

在%TEMP%文件夹中,bitrock_installer_xxxx.log不显示任何其他错误消息:

Log started 05/27/2019 at 12:24:43
Preferred installation mode : unattended
Trying to init installer in mode unattended
Mode unattended successfully initialized
Executing cscript //NoLogo "C:\Users\nducoin\AppData\Local\Temp\postgresql_installer_4263a06887\prerun_checks.vbs"
Script exit code: 0

Script output:
 The scripting host appears to be functional.

Script stderr:


[12:24:45] Using branding: PostgreSQL 11
Executing C:\Users\nducoin\AppData\Local\Temp/postgresql_installer_4263a06887/temp_check_comspec.bat 
Script exit code: 0

Script output:
 "test ok"

Script stderr:


error.install.directory.nondefault

是否可以通过更多日志来调试此问题?有谁知道会出什么问题吗?

1 个答案:

答案 0 :(得分:0)

来自https://postgresrocks.enterprisedb.com/t5/PostgreSQL/Postgresql-11-command-line-installation-fails-on-Windows-for-non/m-p/3698#M299

在以下情况下会发生error.install.directory.nondefault错误消息:

  • 安装PostgreSQL的文件夹不为空
  • 语言环境不是英语
  • 安装文件夹不是默认安装文件夹
  • 尚未安装PostgreSQL。

如果已安装,则如果以前的安装未在默认目录中完成,则会发生错误。

本地化问题是PostgreSQL安装程序中的一个错误,其余就是所需的行为。

具有正确错误消息的解决方案是将语言环境强制为英语: postgresql-11.3-1-windows-x64.exe --unattendedmodeui最小--mode无人值守-前缀“ C:\ PostgreSQL11” --datadir“ C:\ PostgreSQL11 \ data” --serverport 5432 --superpassword test --installer -language -zh-CN