Reputation: 178
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?
Upvotes: 6
Views: 42078
Reputation: 63
You just need to install the gulp-cli.
npm i -g gulp-cli
That is different from what you installed in the node_modules.
Upvotes: 0
Reputation: 21
You can try:
To run this command in the terminal: npx gulp
If want know more visit this Link
Upvotes: 2
Reputation: 53545
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 [email protected] && npm install
Upvotes: 0
Reputation: 85
On MacOS Catalina v10.15.2, the following global install with sudo worked for me.
sudo npm install gulp -g
Upvotes: 7
Reputation: 454
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.
Upvotes: 2
Reputation: 178
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.
Upvotes: 1
Reputation: 117
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
Upvotes: 10
Reputation: 498
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
Upvotes: 3
Reputation: 41
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!
Upvotes: 3
Reputation: 2330
I'm using Ubuntu and found the error of -bash: gulp: command not found
, too. But it became work after npm install gulp -g
Upvotes: 2
Reputation: 878
On MacOS Sierra v10.12.6, the following global install with sudo worked for me.
sudo npm install gulp -g
Upvotes: 0