Login or Sign Up to become a member!
LessThanDot Sit Logo

LessThanDot

Desktop Developer

Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.

LTD Social Sitings

Lessthandot twitter Lessthandot Linkedin Lessthandot friendfeed Lessthandot facebook Lessthandot rss

Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.

Your profile

    Search

    XML Feeds

    Google Ads

    « Getting chocolatey or other powershell scripts to work when behind a proxyProject Kotlin a competitor for Scala »
    comments

    Introduction

    Today I read that nodejs was available on nuget. I wonder why that would be and what extra value that would add to my project. After all nuget is there to install dependent package to my project and keep them up to date. Then I found out that it needed the chocolatey package. The chocolatey package is not really a typical nuget package either. It just uses nuget to get installed. But it peaked my interest. So I installed it.

    installing chocolatey

    so I went to nuget and opened a solution. Nuget won't download packages when not in a solution. And then I did the sensible thing and opened the nuget console and entered this command.

    install-package chocolatey

    With this as the result.

    Successfully installed 'chocolatey 0.9.8.4'.
    ========================
    Chocolatey
    ========================
    Welcome to Chocolatey, your local machine repository for NuGet. Chocolatey allows you to install application packages to your machine with the goodness of a #chocolatey #nuget combo.
    Application executables get added to the path automatically so you can call them from anywhere (command line/powershell prompt), not just in Visual Studio.

    Lets get Chocolatey!
    ----------
    Visual Studio -
    ----------
    Please run Initialize-Chocolatey one time per machine to set up the repository.
    If you are upgrading, please remember to run Initialize-Chocolatey again.
    After you have run Initiliaze-Chocolatey, you can safely uninstall the chocolatey package from your current Visual Studio solution.
    ----------
    Alternative NuGet -
    ----------
    If you are not using NuGet in Visual Studio, please navigate to the directory with the chocolateysetup.psm1 and run that in Powershell, followed by Initialize-Chocolatey.
    Upgrade is the same, just run Initialize-Chocolatey again.
    ----------
    Once you've run initialize or upgrade, you can uninstall this package from the local project without affecting your chocolatey repository.
    ========================

    So I now have chocolatey and I can remove the package from my project.

    Next step seems to be to initialize it.

    With this as the result.

    We are setting up the Chocolatey repository for NuGet packages that should be at the machine level. Think executables/application packages, not library packages.
    That is what Chocolatey NuGet goodness is for.
    The repository is set up at 'C:\NuGet'.
    The packages themselves go to 'C:\NuGet\lib' (i.e. C:\NuGet\lib\yourPackageName).
    A batch file for the command line goes to 'C:\NuGet\bin' and points to an executable in 'C:\NuGet\lib\yourPackageName'.

    Creating Chocolatey NuGet folders if they do not already exist.

    Mode LastWriteTime Length Name
    ---- ------------- ------ ----
    d---- 24/07/2011 18:21 bin
    d---- 24/07/2011 18:21 lib
    d---- 24/07/2011 18:21 chocolateyInstall
    Copying the contents of 'F:\mydocuments\visual studio 2010\Projects\MvcApplication1\packages\chocolatey.0.9.8.4\tools\chocolateyInstall' to 'C:\NuGet'.
    Creating 'C:\NuGet\bin\chocolatey.bat' so you can call 'chocolatey' from anywhere.
    Creating 'C:\NuGet\bin\cinst.bat' so you can call 'chocolatey install' from a shortcut of 'cinst'.
    Creating 'C:\NuGet\bin\cinstm.bat' so you can call 'chocolatey installmissing' from a shortcut of 'cinstm'.
    Creating 'C:\NuGet\bin\cup.bat' so you can call 'chocolatey update' from a shortcut of 'cup'.
    Creating 'C:\NuGet\bin\clist.bat' so you can call 'chocolatey list' from a shortcut of 'clist'.
    Creating 'C:\NuGet\bin\cver.bat' so you can call 'chocolatey version' from a shortcut of 'cver'.

    PATH environment variable does not have C:\NuGet\bin in it. Adding.
    You cannot call a method on a null-valued expression.
    At F:\mydocuments\visual studio 2010\Projects\MvcApplication1\packages\chocolatey.0.9.8.4\tools\chocolateysetup.psm1:139 char:48
    + $hasStatementTerminator= $userPath.EndsWith <<<< ($statementTerminator)
    + CategoryInfo : InvalidOperation: (EndsWith:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull


    Chocolatey is now ready.
    You can call chocolatey from anywhere, command line or powershell by typing chocolatey.
    Run chocolatey /? for a list of functions.

    Not sure if the exception is going to e harmful but I guess I should try.

    installing nodejs

    Now it is time to install nodejs.

    So I typed in

    chocolatey install nodejs

    With this as the result.

    =====================================================
    Chocolatey (0.9.8.4) is installing nodejs (from https://go.microsoft.com/fwlink/?LinkID=206669) to "C:\NuGet\lib"
    =====================================================
    Package License Acceptance Terms
    -------------------------
    Please run chocolatey /? for full license acceptance verbage. By installing you accept the license for the package you are installing...
    -------------------------
    -------------------------
    NuGet
    -------------------------
    Attempting to resolve dependency 'chocolatey (= 0.9.8.4)'.
    Successfully installed 'chocolatey 0.9.8.4'.
    Successfully installed 'nodejs 0.5.2'.

    -------------------------
    -------------------------
    Chocolatey Runner (CHOCOLATEY)
    -------------------------
    -------------------------
    Chocolatey Installation (chocolateyinstall.ps1)
    -------------------------
    Looking for chocolateyinstall.ps1 in folder C:\NuGet\lib\chocolatey.0.9.8.4
    If chocolateyInstall.ps1 is found, it will be run.
    -------------------------
    Elevating Permissions and running powershell -NoProfile -ExecutionPolicy unrestricted -Command "& import-module -name C:\NuGet\chocolateyInsta
    ll\helpers\chocolateyInstaller.psm1; . 'C:\NuGet\lib\chocolatey.0.9.8.4\tools\chocolateyInstall.ps1'". This may take awhile, depending on the p
    ackage.
    -------------------------
    Executable Batch Links
    -------------------------
    Looking for executables in folder: C:\NuGet\lib\chocolatey.0.9.8.4
    Adding batch files for any executables found to a location on PATH.
    In other words, the executable will be available from ANY command line/powershell prompt.
    -------------------------
    Adding C:\NuGet\bin\NuGet.bat and pointing to C:\NuGet\lib\chocolatey.0.9.8.4\tools\chocolateyInstall\NuGet.exe
    -------------------------
    -------------------------
    -------------------------
    Chocolatey Runner (NODEJS)
    -------------------------
    -------------------------
    Chocolatey Installation (chocolateyinstall.ps1)
    -------------------------
    Looking for chocolateyinstall.ps1 in folder C:\NuGet\lib\nodejs.0.5.2
    If chocolateyInstall.ps1 is found, it will be run.
    -------------------------
    Elevating Permissions and running powershell -NoProfile -ExecutionPolicy unrestricted -Command "& import-module -name C:\NuGet\chocolateyInsta
    ll\helpers\chocolateyInstaller.psm1; . 'C:\NuGet\lib\nodejs.0.5.2\tools\chocolateyInstall.ps1'". This may take awhile, depending on the package
    .
    -------------------------
    Executable Batch Links
    -------------------------
    Looking for executables in folder: C:\NuGet\lib\nodejs.0.5.2
    Adding batch files for any executables found to a location on PATH.
    In other words, the executable will be available from ANY command line/powershell prompt.
    -------------------------
    Adding C:\NuGet\bin\node.bat and pointing to C:\NuGet\lib\nodejs.0.5.2\tools\node.exe
    -------------------------
    =====================================================
    Chocolatey has finished installing nodejs
    =====================================================

    And this along the way.

    And now I have to test that node is there I guess.

    And yes that counts as proof.

    And there are other ways to install chocolatey.

    Conclusion

    Yep it works, now I just have to see how to get the new version of nodejs when it comes out and how chocolatey will cover this.

    Edit: @ferventcoder aka Rob reynolds told me there is a wiki that covers all this. you can just type cver nodejs to check if there is a new version and cup to do the update.

    About the Author

    User bio imageChris is awesome.
    Social SitingsTwitterHomePageLTD RSS Feed
    chocolatey, nuget
    InstapaperVote on HN

    3 comments

    Comment from: Robz [Visitor] Email · http://ferventcoder.com
    Robz To learn about newer versions, just type:
    cver nodejs
    To update:
    cup nodejs
    To update all packages:
    cup all
    07/25/11 @ 02:58
    Comment from: Christiaan Baes (chrissie1) [Member]
    Christiaan Baes (chrissie1) Thanks I edited the post.
    07/25/11 @ 03:23
    Comment from: Tahir Khalid [Member] Email
    Oooer, I feel all Linuxy again
    07/25/11 @ 07:08

    Leave a comment


    Your email address will not be revealed on this site.

    To mislead the spambots.

    Your URL will be displayed.
    (Line breaks become <br />)
    (Name, email & website)
    (Allow users to contact you through a message form (your email will not be revealed.)