Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mismatch in gulp local and CLI versions

Tags:

gulp

I had previously installed gulp globally using npm install gulp -g. Then I cloned an existing project, and that required me to use its own gulp. Now when I do a gulp -v from outside my project folder, I get a mismatch like this.

C:\Users\userme>     [11:14:05] CLI version 3.8.11 [11:14:05] Local version 1.0.0 

And when I do a gulp from my project folder, I get this.

C:\project\new\tools> [11:14:26] CLI version 3.8.11 [11:14:26] Local version 3.8.11 

Now I have not been able to merge my JS files properly using gulp (I'm getting some weird formatting errors in the min file) and I suspect it has something to do with this mismatch.

  1. Is there a way to remove the global gulp version, but keep the project specific gulp?
  2. Or can I update my global version gulp to @3.8.11?

Note - I did try updating the global gulp by using npm update [email protected] -g but nothing happened. i still get the mismatch.

Update to describe the issue: I am using gulp to merge multiple JS files into 1 single main.js file. The formatting that I get in the merged file has a syntactical error in it.

Expected output in merged file -

... define('utils/knockoutBindings/slider',['require','ko','jquery'],function(require) {     'use strict';     var ko = require('ko');     var $ = require('jquery'); ... 

Actual output in merged file (this 1 line of code below is wrongly replacing the entire 4 lines above) -

... var'utils/knockoutBindings/slider',['require','ko','jquery'],function(require) { ... 

It might seem that there is an issue in the gulp code, but the same code is used by other users and it works well on their end. The only difference we have found is in the mismatch in my gulp versions.

like image 935
rodiwa Avatar asked Dec 18 '15 06:12

rodiwa


People also ask

How do I change the local version of gulp?

BUT if you don't have admin rights and you can update the local version, but not the global version, then you can run node ./node_modules/gulp/bin/gulp. js from your project folder and it will execute the gulp file, even if you have the wrong CLI version, but you need to have the default task set up.

What is cli version of gulp?

With gulp-cli globally installed : CLI version 1.2.1 Local version 4.0.0-alpha.2. In this case the version displayed is the global version of gulp-cli and the local version of gulp. The global gulp 3.9.

How do I install gulp locally and globally?

To install Gulp locally, navigate to your project directory and run npm install gulp . You can save it to your package. json dependencies by running npm install gulp --save-dev . Once you have Gulp installed locally, you can then proceed to create your gulpfile.

What version of Node works with gulp 3.9 1?

x is the current released npm package that works fine with Node 8 - LTS(Long Term Support stable, which is supported till 2019). When you perform npm install --save-dev gulp , by default it will fetch and install gulp 3.9.


Video Answer


1 Answers

I am answering my own question, just so it is useful for others.

  1. Is there a way to remove the global gulp version, but keep the project specific gulp?

No. AFAIK, you are required to install gulp globally as well as one specific to your project.

More info on gulp versions here.

  • Why do we need to install gulp globally and locally?
  • http://blog.dwaynecrooks.com/post/110903139442/why-do-we-need-to-install-gulp-globally-and
  • https://github.com/gulpjs/gulp/issues/171
  • https://github.com/gulpjs/gulp/issues/140
  1. Or can I update my global version gulp to @3.8.11?

Since I was facing a mismatch in my local version, I had to update it from the project folder itself.

npm install [email protected] --save 

More info on this here.

  • http://www.eskocruz.com/gulp-version-mismatch
like image 68
rodiwa Avatar answered Sep 23 '22 13:09

rodiwa