After generating my project scaffolding, I'd like Yeoman to install my npm dependencies in a subfolder, rather than in the main project folder. I have my package.json file in the /gulp subfolder of my project. How can I have Yeoman install the dependencies there? Here is my current function that runs at the end of the generator:
this.on('end', function () {
if (!this.options['skip-install']) {
this.installDependencies({
bower: false,
npm: true
});
}
});
Finally got this working by changing the directory before running this.installDependencies() in index.js, as in:
this.on('end', function () {
if (!this.options['skip-install']) {
// Change working directory to 'gulp' for dependency install
var npmdir = process.cwd() + '/gulp';
process.chdir(npmdir);
this.installDependencies({
bower: false,
npm: true
});
}
});
Hope this helps if you have a different project scaffolding setup.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With