AndrewMcLagan AndrewMcLagan - 6 months ago 21
Javascript Question

no command 'gulp' found - after installation

After installing gulp.js via NPM i get

no command 'gulp' found
when running the command from the very directory I installed from. Im running an Ubuntu VM.

When i look under the
node_modules/.bin/
directory i can see the
gulp
executable there.

Is there something wrong with my NPM installation? I'm guessing there is.

Answer

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.