boxstarter icon indicating copy to clipboard operation
boxstarter copied to clipboard

Boxstarter shell does not recognise / load Chocolatey cmdlets

Open philoushka opened this issue 10 years ago • 8 comments

  • I've updated my environment via cup chocolatey and cup boxstarter.
  • I've run this via the Boxstarter shell and via a regular PS admin terminal, both with the same results as below
  • Windows 10 latest preview

Am I doing it wrong?

Install-ChocolateyVsixPackage WebEssentials https://visualstudiogallery.msdn.microsoft.com/56633663-6799-41d7-9df7-0f2a504ca361/file/105627/43/WebEssentials2013.vsix

vsix

philoushka avatar Feb 10 '15 17:02 philoushka

@philoushka The cmdlet that you are trying to run, Install-ChocolateyVsixPackage is a cmdlet that ships with Chocolatey, not Boxstarter. When you are installing a Boxstarter Package, Boxstarter actively loads the Chocolatey PowerShell Module, so that these cmdlets are available within your Boxstarter Scripts. However, the Boxstarter Shell, which you are using above, does not have that module loaded.

In order to get this to work, you would need to do

Import-Module C:\Chocolatey\chocolateyinstall\helpers\chocolateyInstaller.psm1

NOTE: The above path might be different for you, depending on what version of Chocolatey you are using, and whether it was a fresh install. If you don't have the above folder, look in C:\ProgramData\Chocolatey.

which would then give you access to the Chocolatey Helper Functions:

image

There error that I received above was due to the fact that I didn't pass valid parameters. In fact, I didn't pass any :smile_cat:

Hope that helps!

gep13 avatar Feb 10 '15 18:02 gep13

Install-ChocolateyVsixPackage is a cmdlet that ships with Chocolatey, not Boxstarter.

My bad. I was mistaken on this. Thanks very much for your help!

philoushka avatar Feb 10 '15 20:02 philoushka

Not a problem at all! :+1:

gep13 avatar Feb 10 '15 20:02 gep13

Hmm. I think this may have come up before. I'm reopening because I think it might be good to load that module in the shell and not just in the context of a boxstarter run. I'm about to dive into the new choco version which could change quite a lot of things here but I'll leave open until i know if this is a keeper or not.

mwrock avatar Feb 10 '15 21:02 mwrock

I'm about to dive into the new choco version which could change quite a lot of things here but I'll leave open until i know if this is a keeper or not.

You and me both. Just getting ducks in a row for ChocolateyGUI, and then going to take the plunge with the new version :smile_cat:

gep13 avatar Feb 10 '15 22:02 gep13

I see that this is still open and am currently running into this issue. I have the latest Chocolatey installed (v0.9.10.3). I also have the following inserted at the bottom of my PowerShell profile, but I am still unable to run Install-ChocolateyVsixPackage from a normal posh prompt. It seems to work fine in the context of BoxStarter, which I understand includes a copy of Chocolatey.

# Chocolatey profile
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
  Import-Module $ChocolateyProfile
}

sumo300 avatar Jun 28 '16 22:06 sumo300

Import-Module "$env:ChocolateyInstall\helpers\functions\Install-ChocolateyVsixPackage.ps1" -Force

MVoz avatar Jun 03 '17 15:06 MVoz

Would be good to have this enhancement

pauby avatar Mar 17 '19 22:03 pauby