I uninstalled grunt with following command.
npm uninstall -g grunt
Then I again installed grunt with following command.
npm ins
All is explained quite nicely on gruntjs.com.
Note that installing grunt-cli does not install the grunt task runner! The job of the grunt CLI is simple: run the version of grunt which has been installed next to a Gruntfile. This allows multiple versions of grunt to be installed on the same machine simultaneously.
So in your project folder, you will need to install (preferably) the latest grunt version:
npm install grunt --save-dev
Option --save-dev
will add grunt
as a dev-dependency to your package.json. This makes it easy to reinstall dependencies.