This article is actually displaying on how to install JQuery using npm which is executed via command line. It is executed in an environment of Command Line Interface (CLI) since the installation process just involving a step of typing the right, suitable or the correct command in the terminal or the text-based interface. It is done in Linux operating system since it actually provides the interface for executing the command. But first of all, the most important thing is to make sure that ‘npm’ as the utility used to install JQuery is already available in the operating system. To be able to do that, just type the following command :
user@hostname:/var/www/html/laravel$ npm Usage: npmwhere is one of: access, adduser, bin, bugs, c, cache, completion, config, ddp, dedupe, deprecate, dist-tag, docs, doctor, edit, explore, get, help, help-search, i, init, install, install-test, it, link, list, ln, login, logout, ls, outdated, owner, pack, ping, prefix, profile, prune, publish, rb, rebuild, repo, restart, root, run, run-script, s, se, search, set, shrinkwrap, star, stars, start, stop, t, team, test, token, tst, un, uninstall, unpublish, unstar, up, update, v, version, view, whoami npm -h quick help on npm -l display full usage info npm help search for help on npm help npm involved overview Specify configs in the ini-formatted file: /home/user/.npmrc or on the command line via: npm --key value Config info can be viewed via: npm help config [email protected] /usr/local/lib/node_modules/npm user@hostname:/var/www/html/laravel$
After positively sure that the npm can be executed via command line through the above command execution in the terminal, just type the following command pattern to install a new module :
npm install [module_name]
The above command’s execution is shown below upon installing JQuery :
user@hostname:/var/www/html/laravel$ npm install jquery npm notice created a lockfile as package-lock.json. You should commit this file. + [email protected] added 1 package in 0.953s user@hostname:/var/www/html/laravel-jtree$
The following is the output of what is actually created if the jquery module installation is carried out successfully. There is a folder named ‘jquery’ inside the folder named ‘node_modules’ in the laravel web-based application project’s folder.
The following is the output showing the content of the folder :
user@hostname:/var/www/html/laravel/node_modules$ ls -al total 16 drwxrwxr-x 4 user user 4096 Oct 31 11:31 . drwxrwxr-x 17 user user 4096 Oct 31 11:31 .. drwxrwxr-x 7 user user 4096 Oct 31 11:31 bootstrap drwxrwxr-x 5 user user 4096 Oct 31 11:28 jquery user@hostname:/var/www/html/laravel/node_modules$
One thought on “How to Install JQuery for Laravel using npm via Command Line in Linux Operating System”