Issue #192 resolved

Installation of Carbon via Chocolatey failed - Windows 10

Guillaume Raymond
created an issue

Here's the console output of the Choco installer (console was ran using Administrator Mode) OS: Windows 10 (not preview)

C:\Windows\system32>choco install carbon
Installing the following packages:
carbon
By installing you accept licenses for the packages.

carbon v2.1.1
The package carbon wants to run 'chocolateyInstall.ps1'.
Note: If you don't run this script, the installation will fail.
Note: To confirm automatically next time, use '-y' or consider setting
 'allowGlobalConfirmation'. Run 'choco feature -h' for more details.
Do you want to run the script?
 1) yes
 2) no
 3) print
1
 C:\ProgramData\chocolatey\lib\carbon\Tools\chocolateyInstall.ps1 : Cannot convert 'System.Object[]' to the type 'System
 .String' required by parameter 'Path'. Specified method is not supported.
 At C:\ProgramData\chocolatey\helpers\chocolateyScriptRunner.ps1:43 char:1
 + & "$packageScript"
 + ~~~~~~~~~~~~~~~~~~
     + CategoryInfo          : InvalidArgument: (:) [chocolateyInstall.ps1], ParameterBindingException
     + FullyQualifiedErrorId : CannotConvertArgument,chocolateyInstall.ps1
The install of carbon was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\carbon\Tools\chocolateyInstall.ps1'.
 See log for details.

Chocolatey installed 0/1 package(s). 1 package(s) failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).
Failures:
 - carbon

Logfile for choco installer is here (I've included only the part with the exception)

#Requires -Version 4
Set-StrictMode -Version 'Latest'
$ErrorActionPreference = 'Stop'

& (Join-Path -Path $PSScriptRoot -ChildPath '..\Carbon\Import-Carbon.ps1' -Resolve)

$installPath = Get-PowerShellModuleInstallPath
$installPath = Join-Path -Path $installPath -ChildPath 'Carbon'

$source = Join-Path -Path $PSScriptRoot -ChildPath '..\Carbon' -Resolve
if( -not $source )
{
    return
}

if( (Test-Path -Path $installPath -PathType Container) )
{
    $newName = 'Carbon{0}' -f [IO.Path]::GetRandomFileName()
    Write-Verbose ('Renaming existing Carbon module: {0} -> {1}' -f $installPath,$newName)
    Rename-Item -Path $installPath $newName
    $oldModulePath = Join-Path -Path (Get-PowerShellModuleInstallPath) -ChildPath $newName
    if( Test-Path -Path $oldModulePath -PathType Container )
    {
        Write-Verbose ('Removing old Carbon module: {0}' -f $oldModulePath)
        Remove-Item -Path $oldModulePath -Force -Recurse
    }
    else
    {
        return
    }

    if( Test-Path -Path $oldModulePath -PathType Container )
    {
        return
    }
}

Write-Verbose -Message ('Installing Carbon: {0} -> {1}' -f $source,$installPath)
Copy-Item -Path $source -Destination $installPath -Recurse

2016-05-02 11:12:57,379 [INFO ] - The package carbon wants to run 'chocolateyInstall.ps1'.
2016-05-02 11:12:57,386 [INFO ] - Note: If you don't run this script, the installation will fail.
2016-05-02 11:12:57,392 [INFO ] - Note: To confirm automatically next time, use '-y' or consider setting 
 'allowGlobalConfirmation'. Run 'choco feature -h' for more details.
2016-05-02 11:12:57,442 [INFO ] - Do you want to run the script?
2016-05-02 11:12:57,479 [INFO ] -  1) yes
2016-05-02 11:12:57,516 [INFO ] -  2) no
2016-05-02 11:12:57,553 [INFO ] -  3) print
2016-05-02 11:12:59,067 [DEBUG] - Calling command ['"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -NoLogo -ExecutionPolicy Bypass -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = '';[System.Threading.Thread]::CurrentThread.CurrentUICulture = ''; & import-module -name 'C:\ProgramData\chocolatey\helpers\chocolateyInstaller.psm1'; & 'C:\ProgramData\chocolatey\helpers\chocolateyScriptRunner.ps1' -packageScript 'C:\ProgramData\chocolatey\lib\carbon\Tools\chocolateyInstall.ps1' -installArguments '' -packageParameters ''"']
2016-05-02 11:13:31,762 [ERROR] -  C:\ProgramData\chocolatey\lib\carbon\Tools\chocolateyInstall.ps1 : Cannot convert 'System.Object[]' to the type 'System
2016-05-02 11:13:31,787 [DEBUG] - Command ['"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -NoLogo -ExecutionPolicy Bypass -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = '';[System.Threading.Thread]::CurrentThread.CurrentUICulture = ''; & import-module -name 'C:\ProgramData\chocolatey\helpers\chocolateyInstaller.psm1'; & 'C:\ProgramData\chocolatey\helpers\chocolateyScriptRunner.ps1' -packageScript 'C:\ProgramData\chocolatey\lib\carbon\Tools\chocolateyInstall.ps1' -installArguments '' -packageParameters ''"'] exited with '0'
2016-05-02 11:13:31,803 [ERROR] -  .String' required by parameter 'Path'. Specified method is not supported.
2016-05-02 11:13:31,843 [DEBUG] - Calling command ['"shutdown" /a']
2016-05-02 11:13:31,878 [ERROR] -  At C:\ProgramData\chocolatey\helpers\chocolateyScriptRunner.ps1:43 char:1
2016-05-02 11:13:31,935 [DEBUG] - Command ['"shutdown" /a'] exited with '1116'
2016-05-02 11:13:31,954 [ERROR] -  + & "$packageScript"
2016-05-02 11:13:32,028 [ERROR] -  + ~~~~~~~~~~~~~~~~~~
2016-05-02 11:13:32,066 [ERROR] -      + CategoryInfo          : InvalidArgument: (:) [chocolateyInstall.ps1], ParameterBindingException
2016-05-02 11:13:32,102 [DEBUG] - Capturing package files in 'C:\ProgramData\chocolatey\lib\carbon'
2016-05-02 11:13:32,105 [ERROR] -      + FullyQualifiedErrorId : CannotConvertArgument,chocolateyInstall.ps1

Comments (7)

  1. Aaron Jensen repo owner

    Any chance you can run it again and get me a full stack trace on each of the errors?

    $Error.Clear()
    # Install from Chocolatey
    $Error | ForEach-Object { $_ ; $_.ScriptStackTrace }
    

    This will help me figure out where I'm getting multiple objects instead of one object.

  2. Aaron Jensen repo owner

    Actually, that probably won't help. It looks like chocolatey runs my install script in the background. Sigh.

    Can you run this code instead and let me know what it returns? I have a sneaky suspicion it returns multiple values on Windows 10.

    function Get-PowerShellModuleInstallPath
    {
        [CmdletBinding()]
        [OutputType([string])]
        param(
        )
    
        Set-StrictMode -Version 'Latest'
    
        $modulePaths = $env:PSModulePath -split ';' 
        $installRoot = $modulePaths | Where-Object { $_ -like ('{0}\WindowsPowerShell*' -f $env:ProgramFiles) }
        if( $PSVersionTable.PSVersion -lt [Version]'5.0.0' -or -not $installRoot -or -not (Test-Path -Path $installRoot -PathType Container) )
        {
            Write-Verbose ('Module path under ''{0}'' not found.' -f $env:ProgramFiles)
            $installRoot = $modulePaths | Where-Object { $_ -like ('{0}\*' -f $env:SystemRoot) }
            if( -not $installRoot -or -not (Test-Path -Path $installRoot -PathType Container) )
            {
                Write-Verbose ('Module path under ''{0}'' not found.' -f $env:SystemRoot)
                Write-Error ('Module path under ''{0}'' and ''{1}'' not found.' -f $env:ProgramFiles,$env:SystemRoot)
                return
            }
        }
    
        return $installRoot
    
    }
    
    Get-PowerShellModuleInstallPath
    
  3. Log in to comment