我正在构建一个生成器,我需要在最后的npm install
在我的应用程序中的某个目录,我尝试了这样的事情:
this.spawnCommandSync('cd', [this.destinationRoot() + '/my/folder'])
this.spawnCommandSync('npm', ['install'])
但是它不工作。
并且npm install
不能在不同的目录中调用,也不能在任何yeoman安装mixins中调用。
传递选项cwd
-就像https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options