How to Install jstree for Laravel using npm via Command Line in Linux Operating System

Posted on

This article is simply an article written to display on how to install jstree using npm. The installation process is actually done by typing a command in the command line available in the operating system. The command line is actually a CLI (Command-Line Interface) available in the operating system such as ‘terminal’. The process is quite simple if ‘npm’ has already been installed. Just type ‘npm’ to make sure that the ‘npm’ utility has already been installed as shown below :

user@hostname:/var/www/html/laravel$ npm

Usage: npm 

where  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

npm@5.5.1 /usr/local/lib/node_modules/npm
user@hostname:/var/www/html/laravel$ 

So, the npm package has been installed. Just type the following command to install a new module using npm :

npm install [module_name]

The following output is displaying on how to install a module named ‘jstree’ via npm in the command line :

user@hostname:/var/www/html/laravel$ npm install jstree
npm notice created a lockfile as package-lock.json. You should commit this file.
+ jstree@3.3.4
added 1 package in 2.982s
user@hostname:/var/www/html/laravel$ 

If the installation process is a success, a folder named ‘jstree’ will be created inside the folder named ‘node_modules’. It is located perfectly in the root folder of laravel web-based application project.

user@hostname:/var/www/html/laravel/node_modules$ ls -al
total 20
drwxrwxr-x  5 www-data user 4096 Oct 31 16:19 .
drwxrwxr-x 17 www-data user 4096 Oct 31 16:19 ..
drwxrwxr-x  7 www-data user 4096 Oct 18 10:45 bootstrap
drwxrwxr-x  5 www-data user 4096 Oct 18 10:45 jquery
drwxrwxr-x  6 user     user 4096 Oct 31 16:19 jstree
user@hostname:/var/www/html/laravel/node_modules$ 

Leave a Reply