Getting a Yeoman App Working on a New Machine after Cloning

If you're working on a Yeoman app from a git repository, you won't be able to simply git clone and then start the Yeoman workflow. There's a small amount of setup to do, so I thought I'd write that out here in a simple list for anyone that also goes through the process.

Scroll down to the bottom if you just want the commands!

Starting out, let's say that you already have a Yeoman project created and in a git repository that you just cloned, and you already have Yeoman, Bower, and Grunt installed (if you're still setting up Yeoman, you can check out the official documentation). If you just try running grunt right off the bat now, you'll probably get an error message.

grunt-cli: The grunt command line interface. (v0.1.9)

Fatal error: Unable to find local grunt.

If you're seeing this message, either a Gruntfile wasn't found or grunt
hasn't been installed locally to your project. For more information about
installing and configuring grunt, please see the Getting Started guide:

The local npm dependencies shouldn't just be copied around with the git repository, and you'll notice that the default .gitignore file ignores the node_models/ directory containing these. You can fix that easily by running npm install, which will install all the dependencies that are already defined in the package.json file.

Now try running grunt again. You'll probably get another error:

Warning: Errno::ENOENT on line ["33"] of /var/lib/gems/1.9.1/gems/compass-0.12.2/lib/compass/exec/global_options_parser.rb: No such file or directory - /path/to/your/app/bower_components

The Bower dependencies of the project are also not copied over, as noted by the fact that app/bower_components/ is also ignored by .gitignore. We can fix that by running bower update.

Now if you run grunt this time, the app should compile like normal, and you'll be up and running.

Here are the steps given above without all the talk:

  1. Make sure you have all dependencies installed (nodejs including npm, ruby and the Compass gem (gem install compass), and Yeoman including yo, grunt, and bower).
  2. npm install
  3. bower update