0

I install gulp using npm install -g gulp

[npm WARN deprecation warnings redacted]
/usr/local/bin/gulp -> /usr/local/lib/node_modules/gulp/bin/gulp.js
/usr/local/lib
└── gulp@3.9.1 

When I try to run the gulp command I get:

gulp
[19:42:23] Local gulp not found in ~/javascript
[19:42:23] Try running: npm install gulp

But when I install another npm package globally, it works. For instance when I install create-react-app like so:

npm install -g create-react-app
/usr/local/bin/create-react-app -> /usr/local/lib/node_modules/create-react-app/index.js
/usr/local/lib
└─┬ create-react-app@0.2.0 
  ├─┬ chalk@1.1.3 
  │ ├── ansi-styles@2.2.1 
  │ ├── escape-string-regexp@1.0.5 
  │ ├─┬ has-ansi@2.0.0 
  │ │ └── ansi-regex@2.0.0 
  │ ├── strip-ansi@3.0.1 
  │ └── supports-color@2.0.0 
  ├─┬ cross-spawn@4.0.0 
  │ ├─┬ lru-cache@4.0.1 
  │ │ ├── pseudomap@1.0.2 
  │ │ └── yallist@2.0.0 
  │ └─┬ which@1.2.10 
  │   └── isexe@1.1.2 
  ├── minimist@1.2.0 
  └── semver@5.3.0 

When I run the command after installation it works:

create-react-app
Usage: create-react-app <project-directory> [--verbose]

Is there any reason why gulp would screw out?

Simpleton
  • 6,285
  • 11
  • 53
  • 87
  • Where is the `npm` bin located at? Type `npm bin -g` and when you get the output, try running the command directly from that path, e.g. on my laptop here is where it's located: `/home/kyle/.linuxbrew/bin`. So I can just run `/home/kyle/.linuxbrew/bin/gulp` and it will run. If you're not seeing this command, it likely means you don't have this path setup in your `$PATH` variable, so you'll need to edit your `.bash_profile` (or appropriate file if you put this somewhere else or use Zsh or another shell). – Kyle Anderson Aug 12 '16 at 17:53
  • the npm bin path is in my $PATH – Simpleton Aug 12 '16 at 17:55
  • 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 Aug 12 '16 at 18:15

1 Answers1

1

You have to install the Gulp CLI to get the command line to work npm install -g gulp-cli

Dave V
  • 1,966
  • 9
  • 18
  • 1
    It just may not work that way. Even their tutorial says to install the CLI globally then Gulp as a package dependency. I've always had both installed, never tried to do it with just the global installation – Dave V Aug 12 '16 at 17:59