How to install Sails.js and dependencies on Windows ? In order to execute sails.js project, all sails.js dependency must be setted up correctly on windows machine. This tutorial explain installation of sails.js and dependencies on windows machine.

Step 1: Install Node.js and npm Package Manager

Sails.js is a small framework build on top of Express and Node.js framework. So first of all, install Node.js and npm using node.js installation MSI from Here. Download MSI, run it and follow installation instructions. It will achieve following 3 important steps.

  1. It will install Node.js framework on your windows machine.
  2. It will install npm package manager on your windows machine
  3. It will add Node.js and npm package manager path to your PATH environment variable of windows.

Node and npm installation

Restart your machine after installation. You can check successful installation by running following commands in Windows Command Prompt.

  • node -v should print node version number.
  • npm -v should print npm version number.

Step 2: Install Sails.js using npm Package Manager

Install sails.js using npm package manger. Run following command in command prompt to install latest version of sails.js. This will install sails.js and all dependent packages in windows machine.

	
npm -g install sails		
	

Step 3: Set up Windows Environment to compile Native Add On Module

This step is not required for every project, but I HIGHTLY RECOMMEND that you follow this steps. Compilation of Node.js Native Add On Modules (e.g. node-gyp) requires following steps performed in order to run. Native Add On Modules are written in C or C++ and can be used in sails application using require() function.

  1. Install Visual C++ Build Tools from Here
  2. Install Visual Studio 2015 and select all C/C++ related components during installation.
  3. Install Python 2.7.X from Here. (Python 3.X.X is not supported)
  4. Set python executables in windows PATH environment variable.
  5. Set python version in npm configuration using following command
    	
    npm config set python python2.7
    	
    
  6. Get Ruby Installer From Here and follow installation link to install ruby on windows.
  7. Set ruby executables in windows PATH environment variable.
  8. Set Microsoft Visual Studio version in npm configuration using following command.
    	
    npm config set msvs_version 2015
    	
    

Path variable list will look like red bordered box below after setting up Python and Ruby executables in PATH environment variable.

Python and Ruby Executables in PATH environment variable

Step 4: Create Sails Project and Lift it

Finally, Windows machine is ready to create sails project and run it.

	
> sails new testProject
> cd testProject
> sails lift testProject
	

sails new testProject will create new project under folder “testProject” in current working directory.
sails lift testProject will run sails project on port 1337 by default.

New Sail js App on Windows

References

Sails JS