Capistrano-grunt: unable to find local grunt

I’m figuring out what it takes to compile production assets by running Grunt on the production server, and I’ve run into a snag with capistrano-grunt.

I have node, npm, and grunt-cli installed globally.

When I run “bundle exec cap production deploy”, it fails trying to run:

/usr/bin/env grunt --no-color --gruntfile /srv/www/nateroling/releases/20140806205818/web/app/themes/roots/Gruntfile`

If I try to run that manually on the server, I get

Fatal error: Unable to find local grunt.

It seems like “npm install” would have to be run for each release before Grunt, but I don’t see that mentioned anywhere.

Am I missing something?

1 Like

There’s another Cap extension for npm: https://github.com/capistrano/npm

For default Roots add these:

set :npm_target_path, -> { release_path.join('web/app/themes/roots') }
set :npm_flags, '--silent'
1 Like

Thanks Scott, that plus capistrano-bower got me where I needed to be.

Edit: actually capistrano-bower isn’t necessary either.

1 Like