【发布时间】:2018-05-20 18:42:06
【问题描述】:
我使用 Inno Setup 为我制作的应用程序创建了一个 Windows 安装程序。作为安装程序的一部分,我已经包含了一些第三方应用程序的安装和一个批处理文件,以执行一些npm 命令可运行的程序或批处理文件。
一切安装正常,但是当批处理文件运行时,我收到消息
'npm' 未被识别为内部或外部命令
命令不运行,因此应用无法打开。但是,如果我将所有内容保持原样并在安装后再次重新运行批处理文件,则命令会执行并且应用程序可以正常工作。如何让批处理文件在安装过程中正常运行?
Inno 设置Run 部分
[Run]
Filename: "{tmp}\Git-2.15.0-64-bit.exe"; Flags: waituntilterminated
Filename: "{tmp}\rubyinstaller-2.3.3-x64.exe"; Flags: waituntilterminated
Filename: "{tmp}\visualcppbuildtools_full.exe"; Flags: waituntilterminated
Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\mongodb-win32-x86_64-2008plus-ssl-3.4.10-signed.msi"; WorkingDir: {tmp}; Flags: waituntilterminated
Filename: "msiexec.exe"; Parameters: "/i ""{tmp}\node-v6.11.0-x64.msi"; WorkingDir: {tmp}; Flags: waituntilterminated
Filename: "{tmp}\setup.bat";
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: shellexec postinstall skipifsilent
批处理文件
cd C:/Users/%USERNAME%/Documents/myApp/api/
call npm install -g bower
call npm install -g grunt
call npm install -g grunt-cli
call npm config set msvs_version 2015 -global
call npm install bcrypt -save
call npm install
cd ../admin/
call npm install -g bower
call npm install -g grunt
call npm install -g grunt-cli
echo 1 | call gem install compass
call bower install
call npm install
【问题讨论】:
-
我遗漏了文件名:"{tmp}\python-3.5.4-amd64-webinstall.exe";标志:waituntilterminated 也已安装
-
它不知道
NPM在哪个文件夹。你需要给它完整的路径。
标签: node.js batch-file npm inno-setup