我试图在Azure上的内置Inno Setup 5代理上安装VS2017,用于我的构建管道之一,但是我在stdout中得到了以下两行代码,但它退出时代码为1,日志文件中没有任何内容。我的问题是:
这里是我认为最重要的两行
innosetup not installed. An error occurred during installation:
The process cannot access the file '...\.chocolateyPending' because it is being used by another process.下面是我在Azure Devops上的构建管道:

我的安装程序脚本是用javascript编写的,并在安装依赖项后通过npm脚本执行。
const utils = require('./utils');
const fs = require('fs');
const path = require('path');
const spawn = require('child_process').spawn;
const command = 'cmd /c choco install innosetup --yes --force --no-progress -ia \'/VERYSILENT\'';
const logDirectory = path.join( 'C:', 'ProgramData', 'chocolatey', 'logs' );
function install() {
return new Promise( resolve => {
const cmd = command.split(' ').filter( ( x, i ) => i === 0 ).join('');
const args = command.split(' ').filter( ( x, i ) => i !== 0 );
var sqlcmd = spawn( cmd, args );
sqlcmd.stdout.on( 'data', data => {
console.log( data.toString().replace( /\r\n$/gmi, '' ) );
} )
sqlcmd.stderr.on( 'data', data => {
console.error( 'error', data.toString() );
process.exit( 1 );
} )
sqlcmd.on( 'exit', code => {
resolve( code );
} )
});
}
( async () => {
utils.header( 'installing Inno Setup' );
const installExitCode = await install();
utils.header( 'Log directory:', logDirectory );
console.log( ' *', fs.readdirSync( logDirectory ).join( '\r\n * ' ) );
utils.header( 'chocolatey.log' );
fs.createReadStream( path.join( logDirectory, 'chocolatey.log' ) ).pipe( process.stdout );
utils.header( 'choco.summary.log' );
fs.createReadStream( path.join( logDirectory, 'choco.summary.log' ) ).pipe( process.stdout );
if ( installExitCode !== 0 ) {
console.log( 'installer exited with error code:', installExitCode );
process.exit( installExitCode );
}
})();下面是我从失败的Azure Devops构建中获得的标准输出:
2019-01-22T18:34:19.0336866Z ########################################
2019-01-22T18:34:19.0337014Z
2019-01-22T18:34:19.0337191Z installing Inno Setup
2019-01-22T18:34:19.0337335Z
2019-01-22T18:34:19.0337513Z Chocolatey v0.10.11
2019-01-22T18:34:19.0337798Z Installing the following packages:
2019-01-22T18:34:19.0338258Z innosetup
2019-01-22T18:34:19.0338554Z By installing you accept licenses for the packages.
2019-01-22T18:34:19.0338705Z
2019-01-22T18:34:19.0338856Z InnoSetup v5.6.1 (forced) [Approved]
2019-01-22T18:34:19.0339051Z innosetup package files install completed. Performing other installation steps.
2019-01-22T18:34:19.0339266Z innosetup not installed. An error occurred during installation:
2019-01-22T18:34:19.0339462Z Item has already been added. Key in dictionary: 'NPM_CONFIG_CACHE' Key being added: 'npm_config_cache'
2019-01-22T18:34:19.0339703Z The process cannot access the file 'C:\ProgramData\chocolatey\lib\InnoSetup\.chocolateyPending' because it is being used by another process.
2019-01-22T18:34:19.0339890Z
2019-01-22T18:34:19.0340054Z ########################################
2019-01-22T18:34:19.0340204Z
2019-01-22T18:34:19.0340364Z Log directory: C:\ProgramData\chocolatey\logs
2019-01-22T18:34:19.0340513Z
2019-01-22T18:34:19.0340775Z * choco.summary.log
2019-01-22T18:34:19.0342937Z * chocolatey.log
2019-01-22T18:34:19.0343090Z
2019-01-22T18:34:19.0343282Z ########################################
2019-01-22T18:34:19.0343425Z
2019-01-22T18:34:19.0343598Z chocolatey.log
2019-01-22T18:34:19.0343738Z
2019-01-22T18:34:19.0344018Z
2019-01-22T18:34:19.0344255Z ########################################
2019-01-22T18:34:19.0344406Z
2019-01-22T18:34:19.0344582Z choco.summary.log
2019-01-22T18:34:19.0344722Z
2019-01-22T18:34:19.0344902Z installer exited with error code: 1发布于 2019-01-23 13:42:14
回答你的一些直接问题..。
Inno支持以这种方式安装吗?
是的,无害安装确实支持以这种方式安装。您可以在包页这里上看到这一点。页面顶部的绿色灯泡表明,该软件包版本通过巧克力的自动化处理程序正确安装,从而验证软件包是否正确安装。
巧克力是否需要在带有登录GUI的机器上运行?
不,在大多数情况下这是不必要的。有一些没有静默安装的巧克力包,用于安装这些“可能”的机制可能要求安装在实际的用户进程中运行,但大多数包不需要这样做。
我做错了什么?
我怀疑“某些东西”在运行npm时不能正常工作,并且安装在承诺的范围内。在日志中,似乎有这样的条目:
2019-01-22T18:34:19.0339462Z项目已经被添加。字典中的键:'NPM_CONFIG_CACHE‘键被添加:'npm_config_cache’
在巧克力原木的中间,这对我来说没有意义。
我最好的建议是在这个扩展上使用独立的巧克力任务(注意:完全公开,我是这个扩展的作者),或者尝试在npm之外进行安装,也许直接使用PowerShell任务。
https://stackoverflow.com/questions/54314785
复制相似问题