Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gulp command not found after install

I installed gulp(globally) and it looks like it worked because it ran this code:

├── tildify@0.2.0 ├── interpret@0.3.5 ├── pretty-hrtime@0.2.1 ├── deprecated@0.0.1 ├── archy@0.0.2 ├── minimist@0.2.0 ├── semver@2.3.2 ├── orchestrator@0.3.7 (stream-consume@0.1.0, sequencify@0.0.7, end-of-stream@0.1.5) ├── chalk@0.5.1 (escape-string-regexp@1.0.1, ansi-styles@1.1.0, supports-color@0.2.0, strip-ansi@0.3.0, has-ansi@0.1.0) ├── gulp-util@2.2.20 (lodash._reinterpolate@2.4.1, dateformat@1.0.8-1.2.3, vinyl@0.2.3, through2@0.5.1, multipipe@0.1.1, lodash.template@2.4.1) ├── liftoff@0.12.0 (extend@1.2.1, minimist@0.1.0, resolve@0.7.4, findup-sync@0.1.3) └── vinyl-fs@0.3.5 (graceful-fs@3.0.2, lodash@2.4.1, mkdirp@0.5.0, strip-bom@0.3.1, vinyl@0.2.3, through2@0.5.1, glob-watcher@0.0.6, glob-stream@3.1.14) 

But when I type gulp it says -bash: gulp: command not found

Any idea what's going on?

like image 944
iluvpinkerton Avatar asked Aug 02 '14 00:08

iluvpinkerton


People also ask

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.

Where is gulp installed?

You can check where it is by typing in npm root -g in the command line. For Mac users, if the root command returns a directory like /Users/YOURNAME/node_modules then this will cause the command not found error. Then you should be able to install the Gulp CLI globally and Gulp locally.

How do I install gulp?

To install Gulp locally, navigate to your project directory and run npm install gulp . You can save it to your package. json dependencies by running npm install gulp --save-dev . Once you have Gulp installed locally, you can then proceed to create your gulpfile.


2 Answers

Turns out that npm was installed in the wrong directory so I had to change the “npm config prefix” by running this code:

npm config set prefix /usr/local 

Then I reinstalled gulp globally (with the -g param) and it worked properly.

This article is where I found the solution: http://webbb.be/blog/command-not-found-node-npm

like image 56
iluvpinkerton Avatar answered Sep 23 '22 05:09

iluvpinkerton


Not sure why the question was down-voted, but I had the same issue and following the blog post recommended solve the issue. One thing I should add is that in my case, once I ran:

npm config set prefix /usr/local 

I confirmed the npm root -g was pointing to /usr/local/lib/node_modules/npm, but in order to install gulp in /usr/local/lib/node_modules, I had to use sudo:

sudo npm install gulp -g

like image 41
thehme Avatar answered Sep 20 '22 05:09

thehme