After installation of Gulp: “no command 'gulp' found”

Javascriptnode.jsNpmGulp

Javascript Problem Overview


After installing gulp.js via npm, I receive a no command 'gulp' found error when running the gulp command from the same directory it was installed into.

When looking under the node_modules/.bin/ directory, I can see the gulp executable there.

Is there something wrong with my npm installation?

Javascript Solutions


Solution 1 - Javascript

That's perfectly normal. If you want gulp-cli available on the command line, you need to install it globally.

npm install --global gulp-cli

See the install instruction.

Also, node_modules/.bin/ isn't in your $PATH. But it is automatically added by npm when running npm scripts (see this blog post for reference).

So you could add scripts to your package.json file:

{
    "name": "your-app",
    "version": "0.0.1",
    "scripts": {
        "gulp": "gulp",
        "minify": "gulp minify"
    }
}

You could then run npm run gulp or npm run minify to launch gulp tasks.

Solution 2 - Javascript

I solved the issue without reinstalling node using the commands below:

$ npm uninstall --global gulp gulp-cli
$ rm /usr/local/share/man/man1/gulp.1
$ npm install --global gulp-cli

Solution 3 - Javascript

I actually have the same issue.

This link is probably my best guess:

https://stackoverflow.com/questions/18130164/nodejs-vs-node-on-ubuntu-12-04

I did that to resolve my problem:

sudo apt-get --purge remove node 
sudo apt-get --purge remove nodejs 
sudo apt-get install nodejs
sudo ln -s /usr/bin/nodejs /usr/bin/node

Solution 4 - Javascript

I solved the issue removing gulp and installing gulp-cli again:

rm /usr/local/bin/gulp
npm install -g gulp-cli

Solution 5 - Javascript

if still not resolved try adding this to your package.js scripts

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

and run npm run gulp it will runt gulp scripts from gulpfile.js

Solution 6 - Javascript

Installing on a Mac - Sierra - After numerous failed attempts to install and run gulp globally via the command line using several different instructions I found I added this to my path and it worked:

export PATH=/usr/local/Cellar/node/7.6.0/libexec/npm/bin/:$PATH

I got that path from the text output when installing gulp.

Solution 7 - Javascript

Tried with sudo and it worked !!

sudo npm install --global gulp-cli

Solution 8 - Javascript

I'm on lubuntu 19.10

I've used combination of previous answers, and didn't tweak the $PATH.

  1. npm uninstall --global gulp gulp-cli This removes any package if they are already there.
  2. sudo npm install --global gulp-cli Reinstall it as root user.

If you want to do copy and paste

npm uninstall --global gulp gulp-cli && sudo npm install --global gulp-cli 

should work

I guess --global is unnecessary here as it's installed using sudo, but I've used it just in case.

Solution 9 - Javascript

in my case there was only on issue, just put "gulp":"gulp" in the script portion, of package.json, and then use command npm run gulp.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAndrewMcLaganView Question on Stackoverflow
Solution 1 - JavascriptBrian ClozelView Answer on Stackoverflow
Solution 2 - JavascriptbinzView Answer on Stackoverflow
Solution 3 - JavascriptguboiView Answer on Stackoverflow
Solution 4 - Javascriptuser6612690View Answer on Stackoverflow
Solution 5 - JavascriptHanzla HabibView Answer on Stackoverflow
Solution 6 - JavascriptG-ManView Answer on Stackoverflow
Solution 7 - JavascriptSopoView Answer on Stackoverflow
Solution 8 - JavascriptMinskyView Answer on Stackoverflow
Solution 9 - JavascriptisrarView Answer on Stackoverflow