Sean
Sean

Reputation: 8025

Gulp: /usr/local/bin/gulp: No such file or directory

Whenever I run gulp, I get the following error:

/usr/local/bin/gulp: No such file or directory

I've followed the answers to several related questions on SO, but none have solved my issue. I've been using gulp without issue for months, but managed to screw it up somehow.

I've removed gulp and gulp-cli (using npm) both locally and globally.

After running the following:

npm install -g gulp-cli
npm install --save-dev gulp

Any command using gulp, even gulp -v returns the error mentioned above. There are no errors during the installation.

I've confirmed there is nothing at /usr/local/bin/gulp, but shouldn't reinstalling things recreate whatever files are supposed to be there?

Any help is appreciated.

EDIT:

Installing gulp globally npm install -g gulp doesn't fix anything.

Upvotes: 0

Views: 12426

Answers (2)

Pierre
Pierre

Reputation: 6172

Do you want to install gulp locally or globally?

Locally

npm install --save-dev gulp gulp-cli should do the trick. You can then run it using:

  • ./node_modules/.bin/gulp
  • npm run gulp if you add gulp to the scripts section of package.json.

Globally

Most likely you have a $PATH issue. Did you check where your global libraries are installed by NPM?

npm list -g

Does installing any other global library work, or is it specific to Gulp?

-- Edit --

If you are using NVM, you should add the NVM setup to your rcfile (that is, ~/.bashrc, ~/.zshrc, ~/.profile or similar). You can do so by appending these lines to your rcfile.

[[ -s $HOME/.nvm/nvm.sh ]] && . $HOME/.nvm/nvm.sh

This will load NVM and update your PATH so that your shell is able to find gulp (or any other globally-installed program by npm or yarn).

Upvotes: 9

John Kariuki
John Kariuki

Reputation: 5724

Try npx gulp so that npm using the gulp version that is installed in your dependencies.

Upvotes: 4

Related Questions