Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gulp command not found

Tags:

npm

gulp

cygwin

Windows 10 pro x64

I ran the following commands

npm install --global gulp-cli
npm init

Then I changed directory to my project:

npm install --save-dev gulp

then tried to run gulp and got

-bash: gulp: command not found

my package.json file reads

{
 "name": "riad-kilani_v4-child",
  "version": "1.0.0",
  "description": "",
  "main": "gulpfile.js",
  "dependencies": {
    "gulp-cli": "^1.2.2"
  },
  "devDependencies": {
    "gulp": "^3.9.1",
    "gulp-sass": "^2.3.2"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

Any ideas on whats going on here?

like image 1000
f1ss1on Avatar asked Nov 02 '16 22:11

f1ss1on


People also ask

Why is gulp command not found?

The problem might be caused by your global npm directory being set to the wrong location. The global npm directory is where your packages get installed when you install them globally. You can check where it is by typing in npm root -g in the command line.

How do I know if gulp is installed?

First run npm -g install gulp-cli then run gulp -v. Alternatively, you can just run npm list gulp.

How do I install gulp globally?

To install the Gulp CLI globally, on your command line, run npm install gulp-cli -g . The -g flag means npm will install the package in the global npm directory, so you can run the gulp command from any directory.


1 Answers

I solved the problem creating an alias in ~/.bashrc like this:

alias gulp="node /home/deploy/app/node_modules/gulp/bin/gulp.js"

Just put the alias in the end of the .bashrc file, then run:

source ~/.bashrc

Test with:

gulp -v

You should see something like this:

[15:46:39] CLI version 3.9.1
[15:46:39] Local version 3.9.1
like image 119
Francisco Zanatta Avatar answered Oct 07 '22 00:10

Francisco Zanatta