This section describes how to install PathFinding.js.
Using Package Managers
PathFinding.js supports installation using npm and bower command line tools.
If Node.js was installed correctly this should print the installed version of] Node.js.
Node.js comes with a Node Package Manager command line tool called npm. It is used to install packages for Node.js. Check that it works:
This should print the installed version of npm.
npm installs the packages in the current folder by default. Make sure you are in your project folder before continuing:
Now you are ready to install PathFinding.js. The npm command to install PathFinding.js is:
npm install pathfinding
This will create a node_modules folder inside the my_new_project folder. PathFinding.js is now installed in the pathfinding folder inside the node_modules folder.
Bower is a front-end package manager. Install it by running the command:
npm install -g bower
Confirm that you can run the bower command:
This should print the installed version of bower.
Navigate to your project folder:
bower install pathfinding
This will create a bower_components folder inside the my_new_project folder. PathFinding.js is now installed in the pathfinding folder inside the bower_components folder.
If you want to use the latest development version you will have to install PathFinding.js manually.
Download the zip from github and extract the contents into the node_modules folder. Don't forget to rename the extracted folder from PathFinding.js-master to pathfinding.
Download the zip from github, extract it in a temporary folder and navigate to this folder:
Now install all the dependencies of PathFinding.js:
Now compile the browser builds:
This will create pathfinding-browser.js and pathfinding-browser.min.js files in the temp_folder/lib folder. You can use these files in your project now.