Q:

Using Grunt or Gulp with OpsWorks

I would like to trigger Grunt or Gulp when I deploy an app on Amazon OpsWorks.
By default, the Node.js layer of OpsWorks run npm install, but not gulp, and I do not know how to write custom recipes: is there another solution?

A:

No, you have to write a recipe.
Even the Node.js layer of OpsWorks installs npm via the recipe:
opsworks-cookbooks / deploy / recipes / nodejs.rb (https://github.com/aws/opsworks-cookbooks/blob/master-chef-11.10/deploy/recipes/nodejs.rb#L20 for Chef 11.10) which reads:
opsworks_nodejs do
    deploy_data deploy
    app application
end

which is defined in:
opsworks-cookbooks / deploy / definitions / opsworks_nodejs.rb (https://github.com/aws/opsworks-cookbooks/blob/master-chef-11.10/deploy/definitions/opsworks_nodejs.rb#L9 for Chef 11.10) and does:
node[:dependencies][:npms].each do |npm, version|
    execute "/usr/local/bin/npm install #{npm}" do
        cwd "#{deploy[:deploy_to]}/current"
    end
end

