postgresql - 在特定目录上的 Windows 上无人值守安装 PostgreSQL 失败
问题描述
我需要在无人值守模式下使用 NSIS 在 Windows 10 上安装 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
有没有办法有更多的日志来调试这个问题?有谁知道会出什么问题?
解决方案
error.install.directory.nondefault 错误消息发生在以下情况:
- 安装 PostgreSQL 的文件夹不为空
- 语言环境不是英语
- 安装文件夹不是默认安装文件夹
- PostgreSQL 尚未安装。
当它已经安装时,如果以前的安装没有在默认目录中完成,则会发生错误。
本地化问题是 PostgreSQL 安装程序中的一个错误,其余的是想要的行为。
获得正确错误消息的解决方案是将语言环境强制为英语: postgresql-11.3-1-windows-x64.exe --unattendedmodeui minimum --mode unattended --prefix "C:\PostgreSQL11" --datadir "C: \PostgreSQL11\data” --serverport 5432 --superpassword test --installer-language -en
推荐阅读
- java - 在 Groovy 或 Java 中实现 re.search() 功能
- mysql - 根据 WHERE 子句中变量中的值更新记录
- java - Java使用Enum Generic的values方法
- jspdf - 尝试保存 PDF 时 IE 中的 jsPDF“预期对象”异常
- python - Django Python中的彩色CSV列
- reactjs - img 未显示在 reactstrap 轮播中
- javascript - 我怎么知道模型上哪个对象已更新。@each EmberJS
- android - 如何为 ImageView 设置最小可扩展值?
- docker - 如何在 Docker 容器中复制和提取 .tar 文件
- javascript - 从被多次渲染的同一组件中收集数据到要发送到服务器的数组中