Grunt and Grunt plugins are installed and managed via the Node.js package manager, npm. So, the first thing to do is install Node.js. Node.js is available in the Ubuntu repository, with its required dependencies. You can install Node.js with the help of the following command.
root@linuxhelp:~# apt install nodejs npm Reading package lists... Done Building dependency tree . Setting up npm (3.5.2-0ubuntu4) ... Processing triggers for libc-bin (2.23-0ubuntu10) ...
And then, check if npm is up to date and running in your system.
root@linuxhelp:~# npm update -g npm
At this point, it’s possible to install Grunt and its CLI. Both of them can be installed by making use of the following command.
root@linuxhelp:~# npm -g install grunt npm WARN deprecated firstname.lastname@example.org: CoffeeScript on NPM has moved to "coffeescript" (no hyphen) /usr/local/bin/grunt -> /usr/local/lib/node_modules/grunt/bin/grunt . +-- email@example.com `-- firstname.lastname@example.org
root@linuxhelp:~# npm -g install grunt-cli loadDep:path-is-absolute |####################------------------------------------------------------------------------- . . +-- email@example.com | `-- firstname.lastname@example.org `-- email@example.com
A Grunt setup involves adding package.json and Gruntfile to the project. So, let us create a new project to test that. Create a new folder first, by making use of the following command.
root@linuxhelp:~# mkdir ~/grunt_project
In this folder, you need to execute this action.
root@linuxhelp:~# npm init This utility will walk you through creating a package.json file. . Use `npm install <pkg> --save` afterwards to install a package and save it as a dependency in the package.json file.
Then, you should give all the essential information about the project name, author, a git repository, version, etc. And then, you need to Enter and it will create a package.json file with all of the information you entered.
With this, the installation of Grunt and Grunt-cli on Ubuntu 16.04 comes to an end.
Thank you! for using Linux Help.
You find this tutorial helpful? Share with your friends to keep
For more help topics browse our website www.linuxhelp.com
Be the first to comment, we value your suggestions. For further queries please comment below.