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

Windows Support #216

Closed
JamesMGreene opened this issue Aug 17, 2012 · 135 comments
Closed

Windows Support #216

JamesMGreene opened this issue Aug 17, 2012 · 135 comments
Milestone

Comments

@JamesMGreene
Copy link

Is anyone working on a install script (variant of "/setup.install.sh") for Windows?

@addyosmani
Copy link
Member

At present there's no one championing Windows support, but this is something we're going to look at in the next version. @reybango had some interest in looking at this recently though. Perhaps he'd like to try seeing if it's possible?

@JamesMGreene
Copy link
Author

@reybango: Is it fair to assume that you were hoping to hook this up with a PowerShell script (vs. suffering through Windows Batch land)?

@reybango
Copy link

@JamesMGreene I really don't have any specific ideas on how to make this work yet. I've only recently been given access. If you have some ideas, please let me know and maybe we can work together on it. Hit me up reybango at gmail.

@Iristyle
Copy link

This is something I could take on.

There are 2 things that would simplify this, from a maintenance perspective.

  • Powershell -- I wouldn't try to do this in a BATCH file, unless absolutely necessary
  • Chocolatey - Chocolatey is rough equiv to apt-get, but for Windows (and is PowerShell based). It can handle installing deps like Git and Ruby without a lot of extra code in the install procedure.

Here's an example of a similar installer that I wrote for a Windows / Graphite publishing tool called PerfTap

icm $executioncontext.InvokeCommand.NewScriptBlock((New-Object Net.WebClient).DownloadString('https://raw.github.com/EastPoint/PerfTap/master/InstallPerfTap.ps1'))

@sindresorhus
Copy link
Member

👍 PowerShell & Chocolatey

Since this is not landing until v2 we got some time to do it right.

Would be nice to get all the homebrew packages we require up on Chocolatey. We currently require: git, optipng, jpeg-turbo, phantomjs, of which it only has git. Any takers?

@Iristyle
Copy link

I already have a Powershell script to install PhantomJs locally for my team.. was actually thinking of doing the pull req for a new Chocolatey package since I think others would benefit.

Install is not too complicated, aside from being dependent on 7zip (which can be installed through Chocolatey)

#grab PhantomJS / unzip to temp dir, and move to program files
(New-Object Net.WebClient).DownloadFile('http://phantomjs.googlecode.com/files/phantomjs-1.6.1-win32-static.zip', "${Env:\temp}\phantomjs-1.6.1-win32-static.zip")
&"${Env:\ProgramFiles}\7-zip\7z.exe" x "`"${Env:\temp}\phantomjs-1.6.1-win32-static.zip`"" "-o${Env:\ProgramFiles}"

# Tweak environment variables
$Env:Path += ";${Env:\ProgramFiles}\phantomjs-1.6.1"
[Environment]::SetEnvironmentVariable("Path", $env:Path, [EnvironmentVariableTarget]::Machine)

You can use COM and Windows Shell to extract zips, but I've found out the hard way that it's not supported on Server Core, which can make it painful if you have a Server Core build server (like us! ;0)

7zip will also be needed to extract the .tar.gz files for Yeoman itself, so...

@Iristyle
Copy link

FYI - Put in the pull request to Chocolatey for PhantomJS, OptiPNG and jpeg-turbo

ferventcoder/nugetpackages#53

Can probably tackle the script conversion tomorrow.

@JamesMGreene
Copy link
Author

Nice, love it. I was unaware of Chocolatey, that's pretty cool.

@JamesMGreene
Copy link
Author

Off-topic: Hey @ryanseddon, apparently you should take a look at Chocolatey (src) if you are still trying to streamline your Bunyip dependencies (e.g. Python) for Windows.

@ryanseddon
Copy link

Oooh thanks @JamesMGreene will do.

@sindresorhus
Copy link
Member

@Iristyle That was fast! Awesome :)

@Iristyle
Copy link

Will hack out install.ps1 now, and will basically mirror the functionality of install.sh as a first step for Windows install.

I'll raise one issue though with installing tooling dependencies like OptiPNG through Chocolatey. I generally try to avoid 'global' packages for small tooling packages like OptiPNG.

I can speak with some experience here, having spent a lot of time automating (for EC2 and for local dev bootstraps), and setting up source repos for my team so that code can be pulled and built with ease by both new devs AND the build server.

I generally draw the line, so that full language frameworks / runtimes are installed on the build server / dev box, and additional tooling should live in the repo (and should be pulled during first build by a package manager when we're talking about binaries). So for instance, I would expect Ruby or the .NET Fx SDK to be on the build server, but OptiPNG or libjpeg-turbo to be a dependency of the project.

Why?

  • Minimal global deps and a 'batteries included' approach promotes easier sharing
  • Tool versions should generally be fixed for a given build IMHO. With global deps (especially on Windows), this can be especially painful - as installing a global version of something may break other projects depending on a different versions
  • Maintaining extra dependencies on a build server is generally a pain; some people may not even have shell access to their build server. It's best to have all tooling setup isolated. Fortunately, I've scripted out creation of our Jenkins server for EC2 -- but any time a global dep is introduced, I have to make sure to script out it's install as well.
  • Managing global paths can be a pain, relative paths are generally simpler to use IMHO

You can see these same issues were recently raised with Grunt, and the 0.4.0 dev branch allows running locally from within node_modules.

I would rather see at least PhantomJS, OptiPNG and libjpeg-turbo installed locally as NPM packages when a project is yeoman init'd / npm install'd

However, I don't know if there are technical or philosophical reasons that these tools are not already packages in NPM? Maybe the authors have no interest in building from source with node-gyp, etc?

@reybango
Copy link

Definitely onboard with this effort. I'm on vacation this week so my time is very limited but I'll be available next week to sync with you guys and help in any way I can.

@sindresorhus
Copy link
Member

I would rather see at least PhantomJS, OptiPNG and libjpeg-turbo installed locally as NPM packages when a project is yeoman init'd / npm install'd

I would too, but someone has to do it. Currently none of these can be directly installed through NPM.

@JamesMGreene
Copy link
Author

I raised a discussion about this with the PhantomJS group but it seems they're fundamentally opposed: https://groups.google.com/forum/?fromgroups=#!topic/phantomjs/tlQJzbCbrPI :)

@addyosmani
Copy link
Member

We would really love for someone to take ownership of helping us get Windows support in place. Since #400, we've decided to no longer support automated install scripts and instead offer an audit script which lets developers know what they're missing and provides links to where to get these dependencies. For the reasons for this please see the issue but it might help simplify the amount of work needed to get this baby installed on Windows if anyone is willing to explore.

@paulirish if you have anyone else you think is worth reaching out to about Windows support it would be baller to get them involved too :)

@Iristyle
Copy link

I can do this as mentioned... but was waiting on @ferventcoder so that I don't have to maintain those packages myself - especially since he's automating package updates on accepted pull reqs. But if necessary, I can host / maintain those bits on my GitHub account and push them up to Chocolatey by hand.

ferventcoder/nugetpackages#53

From the issue you guys closed re: ShellJS (#382)..

Writing a bunch of dep checks in Powershell is not too hard.. but ShellJS has cross-platform tools like which that would be convenient for doing these types of checks and reusing the code. (Note Powershell / Windows doesn't have a which but you can fake it without too much trouble.) My main point being that the checks could be normalized / shared across all OSes instead of allowing them to diverge from one another.

Any thoughts?

@addyosmani
Copy link
Member

@jermbo002
Copy link

Got it working in windows as well, the same way mentioned at decodize. Was a very simple and quick install. Seems to work just fine for me. No issues so far.

@addyosmani
Copy link
Member

@jermbo002 that's excellent to hear. @paulirish Looks like we've got Windows support :) We just need to get the deps captured in the audit. //cc @Hemath

@Iristyle
Copy link

Chocolatey version is

Install Chocolatey

C:\> @powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('http://bit.ly/psChocInstall'))" && SET PATH=%PATH%;%systemdrive%\chocolatey\bin

New Powershell prompt

#1.9.3
cinst ruby

cinst compass -source ruby
cinst nodejs.install
cinst gitextensions

#then as soon as they're available in Chocolatey - based on my pull req
cinst libjpeg-turbo
cinst OptiPNG
cinst PhantomJS

Of course, this could be wrapped up in a single script as well.

Updated with Robs info on installing Compass.

@ferventcoder
Copy link

cinst compass -source ruby ;)

@Iristyle
Copy link

Oh oh.. didn't realize that.. thanks Rob!

@ferventcoder
Copy link

If someone puts together a yeoman package (which I think is happening here?) - then set all of the dependencies to the above in the nuspec.
And in the package perhaps install compass. Or someone could create a compass package to call out to ruby to install it. Then you can just add it as another dependency to the nuspec. This would be cleaner IMHO.

In the end it's just
cinst yeoman

@Iristyle
Copy link

No one has talked about doing a Yeoman package yet.. but that seems the next logical step...

The only thing on top of wrangling the deps, would be to put npm install -g yeoman in install.ps1

@Iristyle
Copy link

FYI - I went ahead and put in the pull req to Chocolatey for Yeoman
ferventcoder/nugetpackages#57

This will install Yeoman and it's dependencies with a single command as Rob mentioned above (after Chocolatey is installed)

cinst Yeoman

@JamesMGreene
Copy link
Author

Yay! Yeoman for all.

@praveenvijayan
Copy link

@ addyosmani - everything seems to be working fine in windows.

@Iristyle
Copy link

@ferventcoder made a couple of tweaks to what I put together and now the yeoman package is available through Chocolatey

@praveenvijayan
Copy link

Yeoman npm install works fine on windows. Initially had some issues with imagemin and phantomjs. But default installation works fine now. I'm using 'yo webapps' for a while, but not tried angular. I'm on node v0.8.21.

@emrecamasuvi
Copy link

"yo webapp" was giving some namespace errors in windows. Today i tried default installation again; "npm install -g grunt-cli bower yo" and "npm uninstall -g yeoman"; voila! You can give happy news to win users now. Thank you.

@addyosmani
Copy link
Member

@sindresorhus I would like to tweet out asking Windows users to try "npm install -g grunt-cli bower yo", "npm uninstall -g yeoman" and "yo webapp" just to verify this works for most people. Sound like a good idea?.

If so, we might consider including this news in the beta 4 post.

@sindresorhus
Copy link
Member

@addyosmani go for it.

@addyosmani
Copy link
Member

Appears to have worked fine for most users but we've had one or two reports of grunt not correctly building after running yo webapp:

@sindresorhus
Copy link
Member

First one:

C:\Development\Projects\likeastore\tmp\app\components\jquery\jquery.js

It should be there, so maybe that person didn't run bower install?

@yveslaroche
Copy link

1.0 beta3 is working fine for me on Windows with the instructions on yeoman.io. I'm currently testing the master branches of "yo" "generator" and "generator-webapp" under windows as well.

@kevva
Copy link
Member

kevva commented Apr 8, 2013

@addyosmani, also regarding the first one, Compass needs to be installed. Regarding the second one I can't spot any problems.

@praveenvijayan
Copy link

@addyosmani - I tried in another win 7 machine with node vv0.8.16 and got an error - npm ERR! cb() never called! [http://pastebin.com/29MnktRe line no:103]. In this machine compass is not installed. I got similar error like first link when I tried grunt.

@sindresorhus
Copy link
Member

npm ERR! cb() never called!, that's an npm bug, upgrade to latest Node.js and npm.

@praveenvijayan
Copy link

@sindresorhus Updated node to v0.10.3 and working fine now. In windows with latest node, compass and git yeoman will work.

@raphaelvalerio
Copy link

@addyosmani I have no issues with beta3 when following the Getting Started instructions to install and run yo webapp. I'm on Win 8 Pro 64-bit, with nodejs 0.10.3, git 1.8.1.msysgit.1, and ruby 1.9.3p392.

In order to track down issues with Windows users, I think it's important to make sure that you get the exact version of Windows, node, git, and ruby they have installed, and -- very important -- the terminal shell they're using. A lot of people don't seem to realize that trying to run commands from, say, Cygwin is not necessarily going to get expected results, since Cygwin installs and runs its own versions of things like Ruby. Frankly, I won't let Cygwin near my system anymore. In my case, I run all CLI stuff through Git Bash (msysgit), not just for Yeoman, but for everything in my development workflow. Git is a boon for us hapless Windows guys, because it helps bridge the gap a little between the cold, hard world of the NT kernel universe and you fancypants POSIX people, while being sensibly flexible.

yo webapp is pain-free, but I ran into problems with yo angular. I've got a list of error reports for that one -- should I post that here, or keep it outside this thread and get it to you separately?

@code26
Copy link

code26 commented Apr 9, 2013

running on Windows 7 x64, Nodejs 0.10.3, Git 1.8.1.2, Ruby 2.0 x64

I just made a fresh installation about an hour ago and works fine from my
end using the default installation steps. Tested "yo webapp" and
installation proceeded properly except it throws the following line at the
end of the scaffolding process:

events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:977:11)
at Process.ChildProcess._handle.onexit (child_process.js:768:34)

"grunt test" and "grunt" works fine though.

I also tried the installation steps for Angular and everything installed
properly. I just noticed though that when running "grunt test", Karma
throws "Fatal error: spawn ENOENT". I was able to workaround it by
changing browsers = ['Chrome'] to browsers = ['ChromeCanary'] on
karma.conf.js. Not sure why it does that (Chrome is my default browser).

On Tue, Apr 9, 2013 at 1:20 AM, Raphael Valerio notifications@github.comwrote:

@addyosmani https://github.com/addyosmani I have no issues with beta3
when following the Getting Started instructions to install and run yo
webapp. I'm on Win 8 Pro 64-bit, with nodejs 0.10.3, git 1.8.1.msysgit.1,
and ruby 1.9.3p392.

In order to track down issues with Windows users, I think it's important
to make sure that you get the exact version of Windows, node, git, and ruby
they have installed, and -- very important -- the terminal shell they're
using. A lot of people don't seem to realize that trying to run commands
from, say, Cygwin is not necessarily going to get expected results, since
Cygwin installs and runs its own versions of things like Ruby. Frankly, I
won't let Cygwin near my system anymore. In my case, I run all CLI stuff
through Git Bash (msysgit), not just for Yeoman, but for everything in my
development workflow. Git is a boon for us hapless Windows guys, because it
helps bridge the gap a little between the cold, hard world of the NT kernel
universe and you fancypants POSIX people, while being sensibly flexible.

yo webapp is pain-free, but I ran into problems with yo angular. I've got
a list of error reports for that one -- should I post that here, or keep it
outside this thread and get it to you separately?


Reply to this email directly or view it on GitHubhttps://github.com//issues/216#issuecomment-16064685
.

@passy
Copy link
Member

passy commented Apr 9, 2013

Could you try to run yo webapp --skip-install? I suppose it's one of the bower install or npm install executions. Are bower and npm on your path, i.e. can you run npm and bower from the same shell?

@code26
Copy link

code26 commented Apr 9, 2013

i ran "yo webapp --skip-install" but still gives the same error at the end:

I'm all done. Running npm install & bower install for you to install the
require
d dependencies. If this fails, try running the command yourself.

events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:977:11)
at Process.ChildProcess._handle.onexit (child_process.js:768:34)

and yes, bower and npm are on my PATH

On Wed, Apr 10, 2013 at 1:05 AM, Pascal Hartig notifications@github.comwrote:

Could you try to run yo webapp --skip-install? I suppose it's one of the bower
install or npm install executions. Are bower and npm on your path, i.e.
can you run npm and bower from the same shell?


Reply to this email directly or view it on GitHubhttps://github.com//issues/216#issuecomment-16126050
.

@yveslaroche
Copy link

@JorPan I got the same error after the auto install of dependencies was added. I reported this yesterday here yeoman/generator-webapp#32 (comment)

I've been using the master branch and the webapp generator was working fine before this change.

Running "npm install & bower install" manually works though.

@kevva
Copy link
Member

kevva commented Apr 10, 2013

Related to nodejs/node-v0.x-archive#2318. We could run something like this, which would solve this:

var win32 = process.platform === 'win32';
spawn(win32 ? 'cmd' : 'npm', [win32 ? '/c npm install' : 'install'], { stdio: 'inherit' });
spawn(win32 ? 'cmd' : 'bower', [win32 ? '/c bower install' : 'install'], { stdio: 'inherit' });

cc @sindresorhus @passy @addyosmani

@passy
Copy link
Member

passy commented Apr 10, 2013

@kevva sgtm
On Apr 10, 2013 2:52 AM, "Kevin Mårtensson" notifications@github.com
wrote:

Related to nodejs/node-v0.x-archive#2318 nodejs/node-v0.x-archive#2318.
We could use https://github.com/ForbesLindesay/win-spawn, @sindresorhushttps://github.com/sindresorhus
@passy https://github.com/passy @addyosmanihttps://github.com/addyosmani.
I've tested and it solved this.


Reply to this email directly or view it on GitHubhttps://github.com//issues/216#issuecomment-16149530
.

@addyosmani
Copy link
Member

sgtm

@sindresorhus
Copy link
Member

Closing as we now support Windows. Feel free to open new tickets if you stumble upon an issue, but make sure it hasn't already been reported (also see closed issues).

@JamesMGreene
Copy link
Author

🤘

@addyosmani
Copy link
Member

As per our announcement back in April, we now officially support Windows as Sindre mentioned earlier. If you run into any new issues regarding Windows support please feel free to ping us on the #yeoman channel or open up a new issue on the relevant generator repo.

@robinboehm
Copy link

Great! 👍

@tomlane
Copy link

tomlane commented Jun 20, 2013

💯

@alguevara7
Copy link

👍

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

No branches or pull requests