Installing font awesome using bower + grunt

In the spirit of letting Bower manage my packages, I’ve installed font awesome using the following: bower install --save fontawesome

Now that I have it installed, I’ve followed one suggestion that I use grunt-contrib-copy to copy the fonts into the font folder. These are the only files that needed to mo

To do this, I ran npm install -g grunt-contrib-copy --save-dev which should save a new devDependencies package in package.json (but in my case for some reason it did not, why?!).

Once added there, I reran npm install where it added it to the node_modules folder. Then I just copied and pasted the copy task from his Github example repository.

Run grunt dev to rebuild everything and voila it works!

I’d be interested to know if anyone else has a better thought about doing this. Quite more involved than I was hoping and I spent all afternoon into the evening trying to figure this all out.

You only want to use the -g option for GLOBAL packages. Things like Grunt or Bower than you’ll run on their own from the command line. Using -g will usually fail without sudo since you don’t have the permissions required to install it system-wide (aka not in the local node_modules dir).

That’s really the only thing you did wrong. The other steps are mostly necessary.

Right, I use -g to install most packages b/c I know I’ll use them on multiple projects if I like them. So I made it a habit to include that flag on purpose. Maybe it’s possible using this flag with --save-dev is where it failed to add it to package.json.

As for sudo, I am on Windows using Command Prompt with Admin privileges :smile:

1 Like

Generally you should try to avoid installing any npm packages globally, even packages like Grunt, Bower and Gulp. Doubly so for packages like the grunt-contrib-* family. Globally installed packages make your projects less robust because you can’t pin them to a known version in the local package.json. Consider a scenario where you and your co-worker have slightly different versions of a global Grunt that are introducing subtle differences or bugs into your build process when each of you did a build. It’s better if everyone (and every “thing” - consider continuous integration servers as well) using the project are using the exact same set of npm modules as defined in the local package.json.

1 Like