2017-12-16T14:34:33Z||2017-12-16T14:34:33Z


我们的build脚本需要运行一个目录的gulpfile.js,然后尝试运行(包含gulp的文件夹是../template):

gulp ../template

结果出现错误:

Local gulp not found in ~/xxx
Try running: npm install gulp

文件夹内是安装了gulp的,问题的build脚本的文件夹内是没有也不可能去安装gulp的,也就是说,我们需要在一个没有安装gulp的文件夹内调用另一个文件夹内的gulp脚本,可以这样:

node ../template/node_modules/gulp/bin/gulp.js --gulpfile ../template/gulpfile.js -cwd ../template myTask