Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gulp-order v1.2.0 causes (gulp build) to throw ReferenceError: Invalid left-hand side in assignment #32

Open
javaosborn opened this issue Oct 11, 2018 · 8 comments

Comments

@javaosborn
Copy link

javaosborn commented Oct 11, 2018

The Problem:
At least for my set up, when I try to build my application gulp-order v1.2.0 throws an error as follows:
... ... ... ... .../node_modules/gulp-order/lib/index.js:7
build 10-Oct-2018 17:36:02 [ERROR] ({Minimatch} = require("minimatch"));
build 10-Oct-2018 17:36:02 [ERROR] ^
build 10-Oct-2018 17:36:02 [ERROR]
build 10-Oct-2018 17:36:02 [ERROR] ReferenceError: Invalid left-hand side in assignment

This version of gulp-order ships with a file src/index.coffee with the following lines:
through = require "through"
{ Minimatch } = require "minimatch"

The second line is the one that ends up causing an issue when it is used to generate the following file:
... ... ... ... .../node_modules/gulp-order/lib/index.js which contains the following lines:
// Generated by CoffeeScript 2.3.1
(function() {
var Minimatch, path, sort, through;

through = require("through");

({Minimatch} = require("minimatch"));

Note the last line (line 7) retains the format from the index.coffee file where we have extra brackets. In order to build, it should look like the following line:
Minimatch = require("minimatch").Minimatch;

The cause in my case is the following:
This just occurred yesterday (10/10/18) when I build my code base because:

  1. Issue "Publish v1.2.0 to npm #31 Publish v1.2.0 to npm" made version 1.2.0 automatically available to many projects
    "sirlantis commented a day ago"
    "I've been under a rock for the last few months. I published 1.2.0 to npm."
    and
  2. My top level package.json had the following in it, which also allowed the project to automatically upgrade to v1.2.0
    ...
    "devDependencies": { ....
    "gulp-order": "^1.1.1", ....

The solution:
A) Modify the above line as follows:
"gulp-order": "1.1.1", OR
B) Figure out why the following line causes a build exception...
{ Minimatch } = require "minimatch"

I am definitely not an expert, so I may be missing something that will make V1.2.0 work fine. That is part of the reason I tried to give you as much info as I could, and info about my work around.
However, my guess is that I am not going to be the only one who is going to rebuild from scratch and hit this issue.
I could be wrong.... :)
Thank you in advance for your help....
Jeff

@demurgos
Copy link
Member

demurgos commented Oct 11, 2018

You probably have an outdated Node version that does not support object destructuring. What is your Node version? (node --version)

@pip25
Copy link

pip25 commented Oct 12, 2018

We experienced the same problem, and I can confirm that the issue is due to an older Node version. The 1.1.1 version of gulp-order ran fine on Node 5.7, 1.2.0 now seems to require 7 or newer.

@rejas
Copy link
Collaborator

rejas commented Oct 12, 2018

Whats your reason for running the develop versions (odd numbers) of node?

@pip25
Copy link

pip25 commented Oct 12, 2018

I think it might have been an accidental oversight on our part (but the codebase is old, so it's hard to say). We upgraded our dependencies to the latest Node (8.12.0), and now things appear to be working fine. Of course, that's just us, not sure if the issue reporter can do this with the same ease.

@k0mpreni
Copy link

@pip25 Did you just made an update from Node 5.5 to 8.12 and update dependencies then it worked or it worked even without updating other dependencies ?

@pip25
Copy link

pip25 commented Oct 17, 2018

@brainlulz I simply changed the Node/NPM version (this was a Maven build that automatically installs the required Node and NPM versions into the workspace), ran the build again and it worked. I don't think I even re-ran npm install, and I most certainly did not update any other dependency versions that we had. Of course, that does not mean that no dependencies exist that break using newer Node versions; perhaps I just got lucky.

@guitarneck
Copy link

I had the same problem, and with the default arguments of module.exports too.
I can't upgrade my old node.js (v4.9.1). This is the last stable version I get on my OSX 10.6.8 from package manager.
I'll need to try to compile a newer node one day.

So I did that patch :
...
Minimatch = require("minimatch").Minimatch;
...
module.exports = function(patterns, options) {
patterns = patterns || [];
options = options || {};
...

Now it's fine.

@sbagshaw-shore
Copy link

I am getting this error with gulp-order 1.1.1 and node 8.9.1 in one of my projects, but in another on the same machine and same versions, I do not get it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants