gulpjs / gulp-cli

Command Line Interface for gulp.
MIT License
401 stars 106 forks source link

How to upgrade to V4? #168

Closed sabsaxo closed 6 years ago

sabsaxo commented 6 years ago

I have these version:

[14:28:52] CLI version 3.9.1
[14:28:52] Local version 4.0.0

But simply cannot figure out how to upgrade the CLI version!

How do I do that?

And in the end I'd simply just like to have Gulp working on my machine, no more no less.

sabsaxo commented 6 years ago

And by the way, why not make it IMPOSSIBLE to have diverging version in the first place, so that users don't have all this fiddling around, and guessing to do? Just asking.

sabsaxo commented 6 years ago

OK, so doing:

npm i gulp@next

Gives me:

[14:39:52] CLI version 2.0.1
[14:39:52] Local version 4.0.0

And now it's working.

Happy (well), but confused.

yocontra commented 6 years ago

@sabsaxo You rely on the API of gulp@next in one project and gulp@3 in another and you have gulp@3 installed globally, what happens? It doesn't work - project dependencies should be isolated and global dependencies are just bad.

You need a version agnostic CLI that just loads the local version blindly. This is what gulp-cli is. Your CLI version doesn't matter, because it supports all versions of gulp.

And by the way, why not make it IMPOSSIBLE to have diverging version in the first place, so that users don't have all this fiddling around, and guessing to do?

You didn't need to do any fiddling, gulp-cli doesn't care what your local project version is. If you have Local Version: 4.0.0 you're using gulp 4, period. You didn't need to do anything.

Instructions to use gulp 4: npm i gulp@next and done.

phated commented 6 years ago

npm install -g gulp-cli as per https://github.com/gulpjs/gulp/blob/master/docs/getting-started/1-quick-start.md

sabsaxo commented 6 years ago

Thanks, for clearing that out. But the confusion is there non the less.

Why did running:

npm i gulp@next

downgrade the CLI from 3.9.1 to 2.0.1?

yocontra commented 6 years ago

@sabsaxo The CLI is installed globally and isn't even the same package, npm i gulp@next would absolutely not do anything to your gulp-cli version. If it did, that would be a major bug in NPM that you should report there.

Not sure why you reopened but I'm closing this because this isn't a bug. If you have questions about using NPM or issues with NPM you can use StackOverflow or the NPM issue tracker.

sabsaxo commented 6 years ago

What would be the explanation of the different versions shown in the terminal when running gulp --version:

[14:28:52] CLI version 3.9.1
[14:28:52] Local version 4.0.0

vs

[14:39:52] CLI version 2.0.1
[14:39:52] Local version 4.0.0

after running npm i gulp@next?

rolinger commented 5 years ago

@sabsaxo - I just ran into the same thing and logically it makes no sense. It was driving me nuts too because I kept thinking I was somehow installing an older cli package...only to find out the current npm gulp-cli version is 2.2.0. Upgrading to a lower version number.

rolinger commented 5 years ago

@sabsaxo - I wonder if the original cli was a part of the gulp package, and later they split it out to its own gulp-cli package - and reset the gulp-cli version numbers. This repo is only 2 years old (right around the time that gulp 4 came out) while the gulp 3, probably with an embedded cli, was out for many years. Its the only logical thing I can come up with.

phated commented 5 years ago

@rolinger yes, that is correct. More information here: https://medium.com/gulpjs/gulp-sips-command-line-interface-e53411d4467