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?
To solve the error "gulp: command not found", install the gulp-cli package globally by running npm install -g gulp-cli and restart your terminal. If the command fails, run it with sudo and make sure the correct PATH is set in your system's environment variable.
First run npm -g install gulp-cli then run gulp -v. Alternatively, you can just run npm list gulp.
The global npm directory is where your packages get installed when you install them globally. 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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With