NPM
npm makes it easy for JavaScript developers to share and reuse code, and it makes it easy to update the code that you're sharing. In order to install npm, you need to install node.js first. Run following command
node -v
Node comes with npm installed so you should have a version of npm. However, npm gets updated more frequently than Node does, so you'll want to make sure it's the latest version.
sudo npm install npm -g.
Test: Run npm -v. The version should be higher than 2.1.8.
Grunt
Grunt is a java script task runner, it will help you on running various task like minification, compilation, unit testing, linting, etc. Grunt and Grunt plugins are installed and managed via npm. To start, you need to install Grunt's command line interface (CLI) globally.
sudo npm install -g grunt-cli
This will put the grunt command in your system path, allowing it to be run from any directory.
A typical setup will involve adding two files to your project: package.json and the Gruntfile.
package.json: This file is used by npm to store metadata for projects published as npm modules. You will list grunt and the Grunt plugins your project needs as devDependencies in this file.
Gruntfile: This file is named Gruntfile.js or Gruntfile.coffee and is used to configure or define tasks and load Grunt plugins. When this documentation mentions a Gruntfile it is talking about a file, which is either a Gruntfile.js or a Gruntfile.coffee.
npm init
Run this command on root directory of your project to create package.json.
To install grunt to your project directory you just need to run:
npm install grunt --save-dev
grunt
Run this command to execute your javascript task on project.
Bower
Bower is a package manager for web. Web sites are made of lots of things — frameworks, libraries, assets, utilities, and rainbows. Bower manages all these things for you. You can install bower with this command.
sudo npm install -g bower
bower install jquery
bower install git://github.com/user/package.git
bower install http://example.com/script.js
bower init
grunt-bower
Copy bower installed components to dist folder. Install grunt bower with this
npm install grunt-bower
grunt.loadNpmTasks('grunt-bower');