0

I've installed Gulp like this:

npm install gulp -g

When I try gulp -v I get this:

[16:19:03] CLI version 3.9.1

But when I try to use gulp in my project by running gulp enter code here I receive:

[16:20:40] Local gulp not found in ~/Code/gulp
[16:20:40] Try running: npm install gulp

What is wrong?

Jamie
  • 10,302
  • 32
  • 103
  • 186
  • 3
    Possible duplicate of [Why do we need to install gulp globally and locally?](http://stackoverflow.com/questions/22115400/why-do-we-need-to-install-gulp-globally-and-locally) – Sven Schoenung Jun 11 '16 at 17:35

2 Answers2

2

Gulp requires two parts to work in any project:

  1. the gulp object that has the 5 functions attached, (src,dest, watch, run, task). this is installed locally for a project, as well as all the plugins necessary, because it is included in your taskfiles such as gulpfile.js. Its a locally imported module.

npm install --save-dev gulp

  1. the gulp-cli, because this is a command line utility, that can be called from anywhere on your computer. Its a globally accessible cli command. You console needs to be able to see it. You do not import this.

npm install -g --save gulp-cli

you can see more here: https://www.npmjs.com/package/gulp-cli/tutorial

the_5imian
  • 887
  • 4
  • 7
0

You have to install gulp inside your project:

npm install --save-dev gulp

Nhan
  • 3,595
  • 6
  • 30
  • 38