2.7 KiB
Installation
This section describes how to install PathFinding.js.
Using Package Managers
PathFinding.js supports installation using npm and bower command line tools.
For Server
Node.js is an environment for running javascript on the server. Download and install Node.js for your OS and confirm that it works from the command line:
node -v
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:
npm -v
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:
cd <my_new_project>
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.
For Client
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:
bower -v
This should print the installed version of bower.
Navigate to your project folder:
cd <my_new_project>
Install pathfinding:
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.
Manual Installation
If you want to use the latest development version you will have to install PathFinding.js manually.
For Server
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.
For Client
Download the zip from github, extract it in a temporary folder and navigate to this folder:
cd <temp_folder>
Now install all the dependencies of PathFinding.js:
npm install
Now compile the browser builds:
gulp compile
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.