Ben
Ben

Reputation: 11188

Where to install gulp?

I'm trying to leverage from Elixer so I started to get up and running. I've installed Node and Npm. Later I also installed Gulp using sudo npm install gulp -g. But this installed Gulp in my project directory, resulting in a massive file transfer from my local host to the webserver. Is it necessary to install Gulp inside the project directory? Or is there a better way to install it somewhere else and use it for any project needed?

Sorry if this is a total beginners question but I can't seem to find an answer online. Thanks.

Upvotes: 1

Views: 1551

Answers (3)

David
David

Reputation: 4895

Gulp, bower, ... are dependencies.

The command npm install ... will download the module to the directory named node_modules. They need to be (litterally) a part of your project. Think of it as a pure JS library (as it actually is).

Upvotes: 2

Smile0ff
Smile0ff

Reputation: 798

There is only few steps to start use it.

  1. Install globally $ npm install --global gulp
  2. Install directly to your project root dir $ npm install --save-dev gulp
  3. Create gulpfile.js in root dir

Then in your new gulpfile do the follow:

var gulp = require('gulp');

gulp.task('default', function() {
  // place code for your default task here
});

and after that just type gulp command in terminal to execute default task

here is documentation to help you started with gulp docs and here you can find packages to use it npmjs.com

Tip: if you on OSX use sudo to install npm/jspm/gulp etc

Upvotes: 2

samvv
samvv

Reputation: 2134

sudo npm install gulp -g shouldn't be installing gulp in your project directory. However, Gulp does always need to be installed locally in the project folder in order for it to work. Otherwise, you will get an error when trying to run Gulp. The -g global installion of Gulp is only needed for linking the shell to the binary $ gulp; it will dispatch to the local gulp program as soon as it is called.

Upvotes: 1

Related Questions