Getting Started with Gulp
-
You will need:
- Node.js and npm (Node Package Manager)
- Gulp
- spycam.io IP Camera Tool
Step 1 - Install Node.js
to install Node, visit nodejs.org and click the "Install" button to download the installer for your OS. Follow the instructions and after finished, you should have Node and npm (Node Package Manager) installed. To ensure that Node is properly installed type into the terminal:
node -v npm -v
you should get a response with the version number of Node
get version number of npmStep 2 - Prepare
Navigate to your project directory e.g.:
cd /Documents/Project/my-project
the ls command will list the contents of a directory and helps finding your way around, cd will change the directory, use the [Tab] key to auto-complete long directory-names. Once you made it to your project directory, use npm to initialize your package.json file:
npm init
will create the package.json file in your root directory which will provide information about your project and help manage dependencies
Step 3 - Install Gulp
sudo npm install -g gulp gulp -v
grant you administrator access (sudo), install package globally (-g)
should return the Gulp version numberAlso install gulp locally, using the --save-dev flag to add the dependency to your devDependencies list in package.json
npm install --save-dev gulp
Step 4 - Install required Plugins
npm install gulp-jshint gulp-sass gulp-concat gulp-uglify gulp-rename --save-dev
*for spycam.io 0.2.2 use:
npm install gulp-browserify gulp-connect gulp-plumber gulp-sass gulp-util plumber reactify require-dir vinyl-buffer vinyl-source-stream watchify --save-dev
prepend with sudo e.g. sudo npm install gulp-sass --save-dev if you are getting permissions errors, also read this great article to find out more about these plugins also to learn more about how to use your command-line interface
Step 5 - Start spycam.io tool
Download the spycam.io IP Camera Tool source code and extract it to your project folder and run Gulp:
gulp
this will call gulp and run everything needed to start spycam.io
Step 6 - Access spycam.io tool
- in your browser navigate to http://localhost:8080 and you should see the IP Camera Tool up and running!
Troubleshooting
How to resolve "Cannot find module" error?
While still in your project folder, run npm install {module-name} more info here e.g. require-dir