O
O
Oleg Vorobyov2018-03-20 09:08:56
JavaScript
Oleg Vorobyov, 2018-03-20 09:08:56

Why install gulp globally and locally?

Why do the manuals say to install gulp globally first (with the -g flag) and then locally? Why is this needed? Isn't it possible to install only locally? I'm asking purely out of curiosity. What is the difference?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dima Polos, 2018-03-20
@type34

You need to install gulp-cli globally, not gulp, but you need to install gulp locally. Gulp-cli is a utility, or program, that will log the gulp command to the console. CLI - command line interface, command line interface, something like that. This is necessary so that you can run tasks in the console using a command like 'gulp task'. If gulp-cli is not installed, then to start tasks, you would have to write something like 'node gulpfile.js', and then the problem is that you still need to specify which task specifically you need to run, because node will just run a script, and all tasks that are declared and called there will be executed. Or you would have to register scripts for aliases, shortened commands in package.json, and to start you would have to write npm run task, and then you need to describe this task in package.json. Difficult, in short. Gulp-cli can take the name of a task and call it from gulpfile.js. Now you describe tasks in gulpfile, and call them through gulp.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question