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

Add support for Windows #284

Closed
lmayorga1980 opened this issue Aug 22, 2013 · 27 comments
Closed

Add support for Windows #284

lmayorga1980 opened this issue Aug 22, 2013 · 27 comments
Labels
feature requests I want a new feature in nvm! OS: windows

Comments

@lmayorga1980
Copy link

No description provided.

@creationix
Copy link
Collaborator

Are you using bash on windows? Also there are nvm projects for windows like https://github.com/hakobera/nvmw

@eirslett
Copy link

eirslett commented Oct 6, 2013

Why aren't nvm and nvmw merged into one single project?

@ljharb
Copy link
Member

ljharb commented Oct 6, 2013

Because then anyone wishing to work on nvm would have to test on Windows (a pretty burdensome request), and anyone working on nvmw would have to test on *nix.

This was referenced Sep 20, 2014
@mcandre
Copy link

mcandre commented Sep 20, 2014

@ljharb We can automate these tests with various tools. E.g., Firefox developers don't have to manually test their commits on Windows, Mac, and Linux.

@ljharb
Copy link
Member

ljharb commented Sep 21, 2014

Automated browser and linux testing is a solved problem - I'm not personally familiar with any free/open source solutions for automating non-IE Windows-based testing.

That said, if someone wants to submit a PR that can run automated tests on Windows, that would absolutely clear one of the bigger obstacles to supporting it.

@coreybutler
Copy link
Contributor

For what it's worth, I recently released nvm for windows. It's not a direct port of this project, but it provides the major functionality. It's written in Go, so theoretically it could support OSX/Linux using the same code base if I/someone felt like tweaking it.

@ljharb
Copy link
Member

ljharb commented Oct 4, 2014

@coreybutler there's already "nvmw" - please do not name your project "nvm", as that's the name of this project.

@coreybutler
Copy link
Contributor

@ljharb - I wrote mine as a response to the fact nvmw broke after node 0.10.26, and according to the author's comments in an issue, he doesn't know how to fix it... and I found it easier to write something new than keep contributing to that code base.

If it's really a problem to have the name "nvm for windows", I can change it... but as a Windows AND Mac user that has to switch between Operating Systems regularly, I can say I wish there were a consistent cross-OS command. I can't tell you how many times I typed "nvmw" on Mac or "nvm" on Windows. While minor, the user experience is still annoying. This was a first attempt at easing that annoyance.

@creationix - Thoughts about naming? I'm not trying to step on toes here... nvm was the inspiration for my project... I just needed the functionality on Windows and the other available projects weren't solving the problem.

@ljharb
Copy link
Member

ljharb commented Oct 4, 2014

Ah, I wasn't aware nvmw was broken. Even if it wasn't, it's of course always fine to develop an alternative to a tool :-)

Note, I'm not suggesting you shouldn't use an executable named "nvm" for consistency - I'm suggesting that the actual name of the repo/project shouldn't just be "nvm".

@coreybutler
Copy link
Contributor

@ljharb - fair enough - I renamed the repo to nvm-windows to show some separation.

ljharb added a commit to ljharb/nvm that referenced this issue Oct 4, 2014
ljharb added a commit to ljharb/nvm that referenced this issue Oct 4, 2014
ljharb added a commit to ljharb/nvm that referenced this issue Oct 4, 2014
ljharb added a commit to ljharb/nvm that referenced this issue Oct 4, 2014
@ljharb
Copy link
Member

ljharb commented Oct 4, 2014

Thanks! I added a note to the README about Windows options.

@coreybutler
Copy link
Contributor

Thanks!

@nschonni
Copy link

nschonni commented Oct 8, 2014

You might want to check out http://www.appveyor.com/ for testing the builds on Windows.

@ljharb
Copy link
Member

ljharb commented Dec 17, 2014

Closing this now, since the Windows options are noted in the README.

@ljharb ljharb closed this as completed Dec 17, 2014
@tugberkugurlu
Copy link

👍 for @nschonni suggestion.

@winniehell
Copy link

Are there any issues with running nvm (for non-Windows) with Cygwin on Windows? I don't see why development has to be done (at least) twice if there is an option get down to the root of all evil.

@mcandre
Copy link

mcandre commented May 1, 2015

@winniehell Cygwin / MSYS / Git Bash are fantastic, but there are situations where you want to be able to use a tool in an ordinary cmd.exe Command Prompt or PowerShell session.

For example, you might have some MS-DOS batch .bat scripts that you want to chain together with a Node.js tool, maybe even with a Makefile to coordinate the chain. It's easy for these to conflict, as Cygwin can't run .bat files (open feature request), and Command Prompt can't run nvm.

@rainabba
Copy link

Why not just support Windows as should be the case since Node.js as a project sees Windows as a first-class citizen? The split projects creates additional issues.

@ljharb
Copy link
Member

ljharb commented Aug 16, 2015

node and npm consider Windows a first-class citizen. That's not necessarily the case with unaffiliated project authors.

In general terms, I don't typically support Windows because the burden of running both manual and automated tests on it is massive. Specific to nvm, it's problematic enough supporting POSIX without having to support an alternative shell paradigm - we don't support fish either for a similar reason.

@ljharb ljharb added the feature requests I want a new feature in nvm! label Oct 11, 2015
@GitTom
Copy link

GitTom commented Apr 23, 2016

It sounds like MS's new Windows Subsystem for Linux (WSL) might make it easier for lots of nix command-line projects to support Windows 10:
https://blogs.msdn.microsoft.com/commandline/2016/04/06/bash-on-ubuntu-on-windows-download-now-3/

I know this isn't a perfect solution for nvm on Windows but probably an easy one.

@ljharb
Copy link
Member

ljharb commented Apr 23, 2016

@GitTom once Windows Bash supports the right POSIX syscalls, nvm will work with it. It doesn't quite yet.

@Joris-van-der-Wel
Copy link

Joris-van-der-Wel commented Aug 21, 2016

I just used nvm successfully using "bash on ubuntu on windows". The install script had some quirks though, the download "failed" until I executed sudo apt-get install git, even though curl was installed:

joris@FOOBAR:/mnt/d/Users/J/Projects/jsdom$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.4/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  9135  100  9135    0     0  53946      0 --:--:-- --:--:-- --:--:-- 54053
=> Downloading nvm as script to '/home/joris/.nvm'
Failed to download 'https://raw.githubusercontent.com/creationix/nvm/v0.31.4/nvm-exec'

=> Appending source string to /home/joris/.bashrc
bash: line 293: /nvm.sh: No such file or directory
=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="/home/joris/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  # This loads nvmjoris@FOOBAR:/mnt/d/Users/J/Projects/jsdom$
joris@FOOBAR:/mnt/d/Users/J/Projects/jsdom$ sudo apt-get install git curl wget
# ...snip...

joris@FOOBAR:/mnt/d/Users/J/Projects/jsdom$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.4/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  9135  100  9135    0     0   126k      0 --:--:-- --:--:-- --:--:--  125k
=> Downloading nvm from git to '/home/joris/.nvm'
=> fatal: destination path '/home/joris/.nvm' already exists and is not an empty directory.
Failed to clone nvm repo. Please report this!
joris@FOOBAR:/mnt/d/Users/J/Projects/jsdom$ rm -rf /home/joris/.nvm
joris@FOOBAR:/mnt/d/Users/J/Projects/jsdom$ curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.4/install.sh | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  9135  100  9135    0     0   167k      0 --:--:-- --:--:-- --:--:--  168k
=> Downloading nvm from git to '/home/joris/.nvm'
=> Cloning into '/home/joris/.nvm'...
remote: Counting objects: 5222, done.
remote: Total 5222 (delta 0), reused 0 (delta 0), pack-reused 5222
Receiving objects: 100% (5222/5222), 1.42 MiB | 966.00 KiB/s, done.
Resolving deltas: 100% (3148/3148), done.
Checking connectivity... done.
* (detached from v0.31.4)
  master

=> Source string already in /home/joris/.bashrc
bash: line 293: /nvm.sh: No such file or directory
=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="/home/joris/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"  # This loads nvmjoris@FOOBAR:/mnt/d/Users/J/Projects/jsdom$ exit
exit

D:\Users\J\Projects\jsdom>bash
joris@FOOBAR:/mnt/d/Users/J/Projects/jsdom$ echo $NVM_DIR
/home/joris/.nvm
joris@FOOBAR:/mnt/d/Users/J/Projects/jsdom$ nvm i node
Downloading https://nodejs.org/dist/v6.4.0/node-v6.4.0-linux-x64.tar.xz...
######################################################################## 100.0%
Now using node v6.4.0 (npm v3.10.3)
Creating default alias: default -> node (-> v6.4.0)
joris@FOOBAR:/mnt/d/Users/J/Projects/jsdom$ node --version
v6.4.0
joris@FOOBAR:/mnt/d/Users/J/Projects/jsdom$ npm --version
3.10.3

@ljharb
Copy link
Member

ljharb commented Aug 21, 2016

Thanks for testing that out!

@ibqn
Copy link

ibqn commented Dec 28, 2016

Does NVM work in git bash on Windows out of the box? Can someone confirm this?

@Joris-van-der-Wel
Copy link

Does NVM work in git bash on Windows out of the box? Can someone confirm this?

The last time I tried, it works properly if you execute the following:

sudo apt-get install git curl wget
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.31.4/install.sh | bash

@rainabba
Copy link

Perhaps this issue should be renamed, "Support for Windows CMD/PowerShell" now since at best, WSL will work and at worse, it will present its own set of issues.

@ljharb
Copy link
Member

ljharb commented Dec 28, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature requests I want a new feature in nvm! OS: windows
Projects
None yet
Development

No branches or pull requests

14 participants