This question already has an answer here:
Inno Setup installer cannot run application just installed by child installer (Unable to run Node. Create process failed)
(1个答案)
2年前关闭。
我已经使用Inno Setup为我制作的应用程序创建了Windows安装程序。作为安装程序的一部分,我包括安装一些第三方应用程序,然后安装一个批处理文件,以执行许多
一切都安装正确,但是当批处理文件运行时,我收到消息
'npm'不被识别为内部或外部命令
该命令无法运行,因此该应用程序无法打开。但是,如果我将所有内容保持不变,然后在安装后再次重新运行该批处理文件,则将执行命令,并且该应用程序可以正常运行。如何在安装过程中使批处理文件正常运行?
Inno Setup
批处理文件
(1个答案)
2年前关闭。
我已经使用Inno Setup为我制作的应用程序创建了Windows安装程序。作为安装程序的一部分,我包括安装一些第三方应用程序,然后安装一个批处理文件,以执行许多
npm
命令可操作程序或批处理文件。一切都安装正确,但是当批处理文件运行时,我收到消息
'npm'不被识别为内部或外部命令
该命令无法运行,因此该应用程序无法打开。但是,如果我将所有内容保持不变,然后在安装后再次重新运行该批处理文件,则将执行命令,并且该应用程序可以正常运行。如何在安装过程中使批处理文件正常运行?
Inno Setup
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
最佳答案
我猜安装程序不会为您修改PATH,因此npm不会作为命令的别名。如果您通过使用可执行文件的绝对路径来调用npm,则它将按预期工作。