Skip to content

Installation not working #16

Open
Open

Description

@dhilgarth
  1. When I use cinst PoshCode the installation is successful according to choco but I can't load the modules
  2. Using iwr http://PoshCode.org/i -OutF PC.ps1; .\PC; rm .\PC.ps1 results in the error that Import-AtomFeed is unknown
  3. Manually importing PoshCode.psd1 is working without error: Import-Module d:\Data\Apps\_Chocolatey\lib\PoshCode.4.0.1.5\PoshCode.psd1, but executing Find-Module returns this error:

PS C:\WINDOWS\system32> Find-Module shortcut
Import-Module : The specified module 'D:\Data\Apps_Chocolatey\lib\PoshCode.4.0.1.5\Repositories\NuGet' was not loaded because no valid module file was found in any module directory.
At D:\Data\Apps_Chocolatey\lib\PoshCode.4.0.1.5\Repository.psm1:96 char:21

  •      $Command = Import-Module "${PoshCodeModuleRoot}\Repositories\$(${Repo}. ...
    
  •                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : ResourceUnavailable: (D:\Data\Apps_C...ositories\NuGet:String) [Import-Module], FileNotFoundException
    • FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

And indeed, no such module exists.

Activity

  1. Jaykul commented on Oct 11, 2014

    @Jaykul
    Member

    Woah. All of those are ... really weird.
    Let me look into it :-)

  2. TheBigBear commented on Feb 11, 2015

    @TheBigBear

    I am having the same issue on win 7 and win 8.1 both points 1 and point 2 above are exactly same for me. and it also does not work outside of choco. I have not tried importing psd1 from under choco libs as point 3 above, but other than that part I have to confirm that I found same issues as @dhilgarth

  3. Jaykul commented on Feb 14, 2015

    @Jaykul
    Member

    Looks like the install script is out of sync with the module, I'll try to fix it this weekend.

  4. TheBigBear commented on Feb 16, 2015

    @TheBigBear

    Thanks Jaykul, appreciate you lookign into this.

  5. Jaykul commented on Feb 16, 2015

    @Jaykul
    Member

    Ok, for 1 the problem is (just) that Choco doesn't have (special) handling for PowerShell modules, and so the module gets unpacked ... but not in your PSModulePath. Others have worked around this by just adding the folder to the path, but I think the right solution is to either install the module to the "common" location (C:\Program Files\WindowsPowerShell\Modules) or the user location, OR to add a single chocolatey module location. I'll run this by @ferventcoder and see what he thinks.

    One way or another, I need to write a ChocolateyInstall.ps1 fix for that for this module, and then try to make it so that other PowerShell modules can take a dependency on this package to fix the problem.

    I haven't had time to fix 2 -- I was in the middle of rewriting some stuff to make this compatible with PowerShellGet -- but now I need to decide if I'm going to continue that effort. When Microsoft originally announced PowerShellGet (their own version of this module) for PowerShell 5 I was happy to continue the effort to make sure PowerShell 2, 3 and 4 didn't get left out -- however, the current plan seems to be to ship PowerShellGet as part of OneGet (with down-level support for PowerShell 3 and 4). I'm not sure it's worth the effort to maintain compatibility just for users who are stuck on PowerShell 2.

    Finally, 3 is the same as 1, I think -- hopefully fixing the path problem will fix everything.

  6. ferventcoder commented on Feb 16, 2015

    @ferventcoder

    I like the idea of a single chocolatey powershell module location, just so that it is separate from other modules installed by other means and cleans up nicely by removing that one location. Thoughts?

  7. Jaykul commented on Feb 16, 2015

    @Jaykul
    Member

    I was leaning toward just doing it the way the PowershellGet team does: install them in one of the two "known" locations, and keep track of which ones are ours (and inject metadata so we know where it came from when the user wants to update it).

  8. ferventcoder commented on Feb 16, 2015

    @ferventcoder

    The difference for choco -

    • It's not a user installation, it's a machine installation. If I'm installing a module, I want it to be available to all users of the machine.

    So prefer one location (machine level). I'd prefer that it also be a slightly different location but I can understand putting it in the same well-known modules location.

    How would you plan to handle when a module is installed with PoshGet and user attempts to install same named module through Choco? Or other similar scenarios where an existing module is not known by choco?

  9. Jaykul commented on Feb 16, 2015

    @Jaykul
    Member

    PowerShellGet (by default) does machine installation (to C:\ProgramFiles\WindowsPowerShell\Modules).

    Chocolatey could install to the same location or to it's own. I dislike when installers mess with my PSModulePath, but if you only add one location, it's a one-time change and not a big deal. I don't think we have to worry about collisions much.

    I'm not sure I remember off the top of my head how PowerShellGet deals with collisions, but I think they force you to either:

    1. Remove the existing module (delete the folder so they don't have to overwrite anything)
    2. Install to the "Current User" scope instead (assuming there's nothing there to overwrite)

    Those options seem pretty logical to me ... but like I said, I'm not terribly concerned about the collision scenario (so far, every collision I've observed has been the same module by the same author distributed multiple ways).

    The best behavior, in my opinion, would be to check and make sure the module GUID is the same before doing an "upgrade" or overwrite, but not care how the version that's currently installed got there. The module GUID guarantees that it is the same module (or someone deliberately impersonating it, let's not think about that) regardless of how it got there.

    If the GUIDs don't match up, we could fall back to forcing the user to manually deal with it (basically, fall back to the behavior described above), or just let the user specify -Force and wipe the existing module and install a new one from the repository. I don't think it matters much one way or another as long as we don't do it "accidentally."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions