Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix running `bower install` and `npm install` on Windows #49

Merged
merged 1 commit into from

4 participants

@kevva
Collaborator

child_process.spawn currently only supports .exe files on Windows. Any better solution?

@passy
Owner

I prefer this over adding another dependency just for the workaround. I wonder if we should move the logic to generator in another step, though.

@orestes

Works for me on Win 7 x64. I've patched my generator-angular as well. Thanks @kevva

@sindresorhus sindresorhus merged commit 251cdf8 into from
@sindresorhus

Not that I can think of. If anyone this. Please chime in.

Thanks @kevva

@kevva kevva deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 2 deletions.
  1. +3 −2 app/index.js
View
5 app/index.js
@@ -3,6 +3,7 @@ var util = require('util');
var path = require('path');
var spawn = require('child_process').spawn;
var yeoman = require('yeoman-generator');
+var win32 = process.platform === 'win32';
var AppGenerator = module.exports = function Appgenerator(args, options, config) {
@@ -28,8 +29,8 @@ var AppGenerator = module.exports = function Appgenerator(args, options, config)
console.log('\n\nI\'m all done. Just run ' + 'npm install & bower install --dev'.bold.yellow + ' to install the required dependencies.\n\n');
} else {
console.log('\n\nI\'m all done. Running ' + 'npm install & bower install'.bold.yellow + ' for you to install the required dependencies. If this fails, try running the command yourself.\n\n');
- spawn('npm', ['install'], { stdio: 'inherit' });
- spawn('bower', ['install'], { stdio: 'inherit' });
+ spawn(win32 ? 'cmd' : 'npm', [win32 ? '/c npm install' : 'install'], { stdio: 'inherit' });
+ spawn(win32 ? 'cmd' : 'bower', [win32 ? '/c bower install' : 'install'], { stdio: 'inherit' });
}
});
Something went wrong with that request. Please try again.