4

I'm building a generator and I need at the end to npm install in a certain directory in my app, I tried things like:

this.spawnCommandSync('cd', [this.destinationRoot() + '/my/folder'])
this.spawnCommandSync('npm', ['install'])

but it doesn't work.

And npm install can't be called in a different directory nor any of the yeoman install mixins.

Calvein
  • 2,111
  • 13
  • 28

1 Answers1

6

Pass the option cwd - just like https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options

Simon Boudrias
  • 42,953
  • 16
  • 99
  • 134