Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chocolatey Package #17

Closed
brunowego opened this issue Oct 25, 2014 · 39 comments
Closed

Chocolatey Package #17

brunowego opened this issue Oct 25, 2014 · 39 comments
Milestone

Comments

@brunowego
Copy link

NVM is awesome, saves my time, another program I use is chocolatey, with this package manager you can install easily windows programs.

I wish register nvm in chocolatey but I need the permission to do this.

@coreybutler
Copy link
Owner

If you create a chocolatey package, I'd be happy to maintain it. Feel free to submit a pull request to my chocolatey repository.

@coreybutler
Copy link
Owner

Here's a starter file:

<?xml version="1.0"?>
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <metadata>
    <id>nvm</id>
    <title>NVM for Windows</title>
    <version>1.0.6</version>
    <authors>Corey Butler</authors>
    <owners>Corey Butler</owners>
    <summary>Node.js Version Management</summary>
    <description>Manage the installation and configuration of multiple versions of Node.js simultaneously.</description>
    <projectUrl>http://github.com/coreybutler/nvm-windows</projectUrl>
    <tags>nodejs,node</tags>
    <licenseUrl>https://raw.githubusercontent.com/coreybutler/nvm-windows/master/LICENSE</licenseUrl>
    <requireLicenseAcceptance>true</requireLicenseAcceptance> <!-- or true if you require the user to accept the License before installing -->
    <iconUrl>https://cdn2.iconfinder.com/data/icons/nodejs-1/32/nodejs-32.png</iconUrl>
    <language>en-us</language>
    <copyright>2014 Corey Butler</copyright>
  </metadata>
</package>

Modify as necessary...

@luisrudge
Copy link

++++++++++++++++++++++++1

@justrhysism
Copy link

+1

@wildeyes
Copy link

+1 if this is closed, there should be a link to the chocolatey package. I can't find it on chocolatey - a search returns 0 results.

@PureKrome
Copy link

Should this be closed?

@coreybutler
Copy link
Owner

There is no chocolatey package for this yet, so it should not be closed. The issue that was closed above was only closed because it was a duplicate of this issue. The code I provided above was for anyone who wanted to create a package, but I don't have time to do it right now. My hope is to release a chocolatey package with the new version, but I don't have a timeline for the next version yet (see the Gitter chat for more details).

Installation has been one of the key issues across all node managers. Since this project is growing beyond just Windows, I'd love to see it delivered in convenient ways for everyone, i.e. standard installer, chocolatey, homebrew, yum/apt-get/rpm, etc. I am still working in the weeds of the new version, but I'll eventually reach a point where it would help to have collaborators/maintainers for the different installers. Get in touch if you know of anyone who might be interested.

@PureKrome
Copy link

@coreybutler I'm happy to help with the Chocolatey script. I've been maintaining the TortoiseGit package on choc so i know how to pack and test. We can leave the file in this repo, I can just send PR's when we need to update, test, etc.

As for choc.org .. you should create the initial account there and add me to as a contributor so u have god mode and can bitch me around. The main thing with chocolatey is that a BINARY is needed somewhere, which choc downloads and silent installs. THAT'S hard :/ i hate frickin' installers and crap and I have -zero- experience with those. So if the installer that you've done here can take a SILENT arg, then we're good to roll!!

sounds like a plan?

@coreybutler
Copy link
Owner

Thanks @PureKrome! I haven't really done anything "chocolatey" other than setting up an account and what you see above (i.e. nothing of any real value), so the script is the perfect place to help. The silent install will go hand in hand with the regular installer, so I can provide that.

The "gotcha" is I need to build the new installer. I built the last installer by hand, which sucked. I spent more time on the installer than I did on NVM. The good news is BitRock granted me a full OSS license, and in going through it I've found options to make it "silent friendly".

I have some long flights next week. I'll see how far I can get with BtiRock during that time... my initial reaction is it will not really take that long to do. I'll post back here when that's all done. I assume I'll need your email address to add you as a contributor.

@PureKrome
Copy link

You just need my Choclatey login: PureKrome.

I'll also need the url's of the installer(s) when they are avail. Choc can handle x32 and x64 versions ... but I'm not sure if that applies here? everything is just 32 bit..?

Finally, if there's any command line args (like default settings or locations) .. tell me those too. The --silent install option would want to make sure there's no dialog boxes opened up, etc (hence the silent arg 😄 )

@seriema
Copy link

seriema commented Sep 12, 2015

Do you want help on this?

@luisrudge
Copy link

ping

@PureKrome
Copy link

I'm not sure what the right action should be, from here.

  • We need a place to hold the nuspec (@coreybutler linked to a repo he made, which is empty)
  • The package needs to be tested and uploaded to choc
  • Wait 100000 years for their moderation to approve it?

@coreybutler
Copy link
Owner

I haven't move forward on this for a couple of reasons. The main reason is the installer doesn't work very well in the context chocolatey expects... there are no command line arguments, no silent mode, nada. What really needs to happen is the creation of a new installer. This has pretty much taken a back seat to new development though. With all the movement between io.js/node, a lot has changed... and frankly, most of my time has been consumed by the upcoming NGN effort. I'm hoping to get a new release out this month... but I also have a couple of talks to give this month, so it might spill into early Feb.

@PureKrome - I granted you access to the choc.org account back in April.

@PureKrome
Copy link

Installer is subpar - Ok then.

Well, I'll chill on this until the installer comes back to the modern era and accepts silent mode/cli args etc.

once that's workin', I can do the rest and then use your repo to drop in the few files.

@luisrudge
Copy link

The installer does support silent mode. Here's what I'm doing:

$installDir = $env:temp + "\win-install"
New-Item -ItemType Directory -Force -Path $installDir

#install nvm
$nvmUrl = "https://api.github.com/repos/coreybutler/nvm-windows/releases/latest"
$response = Invoke-RestMethod -Uri $nvmUrl -ContentType 'application/json'
$nvmDownloadUrl = $response.assets | Where-Object {$_.name -eq "nvm-setup.zip"} | Select-Object -first 1 | select -exp browser_download_url
Invoke-WebRequest $nvmDownloadUrl -OutFile $installDir\nvm.zip
Expand-Archive $installDir\nvm.zip -dest $installDir -Force
Start-Process $installDir\nvm-setup.exe -ArgumentList '/silent' | Wait-Process

@coreybutler
Copy link
Owner

@luisrudge - That won't work on all systems since PowerShell isn't available in older environments. However; I have a practice of only officially supporting operating systems that haven't reached EOL (i.e. Win 8/10, not XP)... so this might work.

@PureKrome
Copy link

nvm-setup.exe -ArgumentList '/silent'

/__ important bit? (ignore the PS stuff)

@giggio
Copy link

giggio commented Jan 7, 2016

Right, you could run this om cmd.exe without powershell. Or even on WINDOWS+R. :)

@luisrudge
Copy link

Sure you can.. after downloading the latest release and extracting the zip file, which the powershell script does automagically

@mattheyan
Copy link

This would be great to have!

A few thoughts (forgive me if I missed something in the convo above):

  1. Chocolatey is built on PowerShell, so supported systems that don't have it shouldn't be an issue. Right?

  2. Is an installer really needed? Lots of Chocolatey packages run installers in silent mode, but that's just b/c lots of software out there is only shipped via an installer and the chocolatey package author/maintainer isn't the owner of the software. Is there any reason why you can't just implement a purely PowerShell install? Is most of the difficulty of an installer in the GUI aspects of the installer, or does it do other complex stuff as well (I see that symlinking, and don't overwrite node installs, are mentioned in the readme)?

  3. If you are distributing your own software you can just embed the software files in the package itself. The Chocolatey team actually recommends this approach as I understand it (as long as the size isn't massive). And, if you do that you can just have the chocolatey install script in the same repo, which means you can incorporate it into your dev/release processes, and reduce the likelihood of divergence.

Thanks,
Bryan

@coreybutler
Copy link
Owner

The installer basically collects information to help customize the experience, like determining an alternative installation root. It also serves as a warning, like telling people their existing version of Node will be overwritten. The logic is pretty simple, so it could be maintained separately. This is why the "no-setup" versions exists in the releases.

If someone wants to write a pure powershell installer, that is fine by me. Keep in mind the registry needs to be edited. I don't think I'll have time to maintain that, but I'm open to bringing in a contributor. My only real nit-pick is in workflow. I'd want something that can be updated automatically, i.e. when there is a new core release, Appveyor builds an updated installer (or something along those lines). That said, I'm exploring evergreen capabilities (i.e. autoupdate) since it appears to be pretty straightforward to do this for Go.

@mattheyan
Copy link

@coreybutler Oooh, auto-update sounds awesome!

Questions:

  • I know you say you're exploring, but how far out do you think that will be?
  • Do you think there would be a way to disable it or opt out?

@coreybutler
Copy link
Owner

@mattheyan - I'm pretty sure it will be in the next major release. I hadn't thought of opt-out. Thanks to your comment, that's now on my list. Just to clarify, auto-update means auto-updating the nvm.exe, not to the latest version of node.

@mattheyan
Copy link

Sounds great!

In terms of the installer, whenever you have a chance could you jot down the steps required to install and/or point me to the relevant code of the installer? I can also try to reverse-engineer it, but it would be best to have a list from you since I may miss important bits.

Also, what would need to be done to incorporate it into your release process and appveyor? Most likely once the package is done it won't require changes very often (unless the install logic changes). So an automated process should be able to build and release a new version when a new version of nvm is built, without the need to write any code.

Thanks,
Bryan

@coreybutler
Copy link
Owner

I'll try to write up a spec/steps soon to cover specifics. In the meantime, the high level approach is in the wiki and the super ugly way to get all of the nitty gritty details is in the nvm.iss file, which contains all of the install logic. There are some issues with Appveyor that I need to sort out, so for now I would suggest getting it working however you can, knowing that we'll address Appveyor as soon as plausible. If the chocolatey package is 100% powershell, then it may be as simple as having unit tests (if that's even practical), meaning a separate Appveyor process or alternative build.

Right now, the Appveyor issues are primarily in making sure the latest version of Go is installed for creating the executable. However; the chocolatey installer will leverage the final executable, so my initial thoughts are the completion of the go build process can trigger a follow-on build for any installers.

Again, I'll try to put something more formal together, but here are a couple of other thoughts I've been mulling over (just to get them out):

  • It looks like Docker support for running Windows in a Docker container is available in some form. I'm not sure how robust it is yet, so I'm trying to talk to a few folks at Microsoft about this. This may be an alternative for Appveyor.
  • One of my startups is part of the Microsoft BizSpark program and I may be able to allocate a small Azure server for a Windows build/test environment.
  • I have a deal with Bitrock to use their installer for the GUI-based installs. I've converted most of the installer to this already, but I'm still working with them to automate the installer build process.

While the points above aren't directly related to chocolatey, I wanted to give a brief glimpse into the bigger picture. I'm also interested in bringing in contributors who could help maintain other installers for other platforms (homebrew/apt/yum/etc).

@mattheyan
Copy link

That's a very detailed and helpful install guide. I'll keep you up to date on progress.

@arieljannai
Copy link

I've created a portable package, currently waiting for approval - nvm.portable

Source code: chocolatey-nvm-windows.

@mattheyan
Copy link

@arieljannai - I see the reviewer came back with a few minor feedback items. 1) Why remove the AppData folder? (Answer: that's where the app is installed ;P), and 2) Should the package name be 'nvm' instead? (I think probably so) What's your take on those questions? Let me know if I can help.

-Bryan

@arieljannai
Copy link

I just didn't had time for that 😅

@equinox
Copy link

equinox commented Aug 13, 2016

Aaaaaaaaaand rejected. :(

@arieljannai
Copy link

I was on a vacation, so didn't had time to look at it 😅
I hope I'll have time to for that in the next few days, I'll update

@dragon788
Copy link

I just tested the package (had to download via the link on the left instead of installing from the web via chocolatey. Just a couple things, that probably need looked at.

  1. Newer version is out, 1.1.1 instead of 1.1.0, apparently fixes a couple important things.
  2. Uninstaller doesn't properly remove items from system %PATH%.
  3. For some reason when I install it, the %NVM_HOME% variable never resolves in the %PATH%, but the %NVM_SYMLINK% does just fine.

I tried repacking with 1.1.1 in the nuspec and installChocolatey and it worked, but the same issues in 2 and 3 still presented themselves, though I haven't tried in a completely fresh Vagrant VM yet to see if that's just an issue of being installed after 1.1.0.

I'm going to try and take a look and implement the suggestions/feedback on the Chocolatey package gist, but the pressing need for NVM that I had has mostly resolved itself, so it has lost the priority for me to spend much time on my fork.

@luisrudge I noticed that the silent mode doesn't appear to work if you already have nodejs installed (via chocolatey or otherwise) and so I'm hoping we can find away to work around that limitation with the no-install option, though the conflicts could perhaps be improved if someone has time to work on the nvm-windows installer since the original author of that is busy with other projects.

@espoelstra
Copy link

I opened a pull request against @arieljannai 's repository above that updates it to 1.1.1 and fixes the main issues mentioned during the package review process. Once built and pushed we'll want to see if they have any further qualms, but I'm using my version from our internal package repository and will see if I run into any issues before then.

@dragon788
Copy link

For anybody needing this sooner than later, you can try the "preview" version of nvm from Chocolatey by installing the version here. https://chocolatey.org/packages/nvm.portable/1.1.1 Use choco install nvm.portable --version 1.1.1 and let the maintainers know if you have any issues on their GitHub repository. Once it actually gets approved you can upgrade to the final version by adding --force to the install arguments.

@espoelstra
Copy link

The "takeover" of nvm on Chocolatey is finally complete! Still waiting for the virtual/meta package to get approved, but the nvm.portable package has made it through the process (and the virtual should be an easy approval).

@dragon788
Copy link

The nvm chocolatey package was approved but needs updated to use AU (the Chocolatey automatic package updater) in order to keep up with new releases of nvm automatically.

@pauloinfotec
Copy link

Hi guys,
That's the best solution when you don't have admin permissions: https://github.com/jchip/nvm
It works like a charm.

Open powershell windows and run following commands:
cd $Env:USERPROFILE;
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
Invoke-WebRequest https://cdn.jsdelivr.net/npm/@jchip/[email protected]/install.ps1 -OutFile nvm-install.ps1;
.\nvm-install.ps1 -nvmhome $Env:USERPROFILE\nvm;
NVM Commands:
nvm use <version_number> - to use version
nvm link <version_number> - to set a version as default
nvm install <version_number> - to install new version
nvm uninstall <version_number> - to uninstall version

@coreybutler
Copy link
Owner

Closing. See https://chocolatey.org/packages/nvm.portable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests