6

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?

f1ss1on
  • 168
  • 1
  • 1
  • 14

11 Answers11

10

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
  • Spent hours trying to find a solution for the -bash: /usr/bin/gulp: No such file or directory This was the solution. Thank you! – afishintaiwan Jun 13 '19 at 14:35
6

On MacOS Catalina v10.15.2, the following global install with sudo worked for me.

sudo npm install gulp -g
Anna Jacobson
  • 75
  • 1
  • 4
3

I had got into the same issue. Even after npm install gulp -g and npm install bower -g, both gulp and bower showed the error.

Here is the thing to remember. 1. gulp and bower command does not run in root (sudo). Switch back to the system user and the run it 2. Make sure the folder where you are running gulp has the user permission. else the permission will be denied

Hope this works for you

murtuza hussain
  • 458
  • 1
  • 7
  • 18
3

So I ran into this issue as well and none of the top answers were helping. Everything was installed, uninstalled, restarted, installed globally, etc., etc.... and still got the gulp command not found error. So I opened the package.json file and put in the following after the name field:

  "scripts": {
"start": "gulp"
},

And then I ran npm start in git bash.

Everything ran correctly, I got my dev view in my browser @ localhost and all was right with the world.

Hope this helps!

Rich Wertz
  • 41
  • 1
  • 4
2

I'm using Ubuntu and found the error of -bash: gulp: command not found, too. But it became work after npm install gulp -g

KHACHORNCHIT
  • 2,222
  • 23
  • 19
2

I managed to fix this problem using simple 3 commands found from https://gulpjs.com/

npm install gulp-cli -g

npm install gulp -D

npx -p touch nodetouch gulpfile.js

Hope it helps someone else.

ps: it is not mandatory to use the 3rd command in order to fix the problem.

Community
  • 1
  • 1
2

You can try:

To run this command in the terminal: npx gulp

If want know more visit this Link

Atul
  • 21
  • 2
1

For anyone else who runs into this just run npm install and npm update.

I ran npm rm --global gulp to clear out any version conflicts and then ran npm install --global gulp-cli. This did a clean install of gulp and it works flawlessly now.

Lajos Arpad
  • 64,414
  • 37
  • 100
  • 175
f1ss1on
  • 168
  • 1
  • 1
  • 14
  • 3
    If anyone is coming to this answer in 2020, the instructions at gulp.js have this as the first thing to do: `npm rm --global gulp`. `npm install --global gulp-cli` comes shortly after. So this answer is just doing what the instructions say, which if you're having this issue after doing what the instructions say, I don't see how it can help. – user70848 Jun 23 '20 at 19:53
0

On MacOS Sierra v10.12.6, the following global install with sudo worked for me.

sudo npm install gulp -g

Jonathan Cardoz
  • 874
  • 9
  • 12
0

You didn't mention which versions of node/npm you are using. We had a similar problem and seems that gulp-sass had to be upgraded.

You can try:

rm -fr node_modules package-lock.json &&  npm install -g gulp-sass@3.0.0 && npm install
Nir Alfasi
  • 53,191
  • 11
  • 86
  • 129
0

You just need to install the gulp-cli.

npm i -g gulp-cli

That is different from what you installed in the node_modules.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129