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

Fail to run on NodeJS 10. It says "Node 4.0 or above" #863

Closed
3 tasks done
Wohlstand opened this issue Jun 26, 2018 · 8 comments
Closed
3 tasks done

Fail to run on NodeJS 10. It says "Node 4.0 or above" #863

Wohlstand opened this issue Jun 26, 2018 · 8 comments

Comments

@Wohlstand
Copy link

Wohlstand commented Jun 26, 2018

  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project follows, as appropriate.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Please describe your issue:

Console output when you run electron-packager with the environment variable DEBUG=electron-packager. Please include the stack trace if one exists.

CANNOT RUN WITH NODE 10.5.0
Electron Packager requires Node 4.0 or above.

What command line arguments are you passing? Alternatively, if you are using the API, what
parameters are you passing to the packager() function?

electron-packager ./app "xxxxx" --out=dist --package-manager=yarn --platform=win32 --arch=x64 --electron-version=1.7.8 --icon=assets/win/xxxxx.ico

Please provide either a failing minimal testcase (with a link to the code) or detailed steps to
reproduce your problem. Using electron-quick-start
is a good starting point.

I have NodeJS 10.5 installed and I have tried to use yarn build thing to compile some application, however, electron-packager fails. It thinks "10.5" is OLDER than 4.0. What the heck? 🤣

@welcome
Copy link

welcome bot commented Jun 26, 2018

👋 Thanks for opening your first issue here! If you have a question about using Electron Packager, read the support docs. If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. Development and issue triage is community-driven, so please be patient and we will get back to you as soon as we can.

To help make it easier for us to investigate your issue, please follow the contributing guidelines.

@Wohlstand
Copy link
Author

Wohlstand commented Jun 26, 2018

Just now I made analysis of existing code, and I have found that next thing (copied from cli.js):

var curVer = [4, 0, 0];

var nodeVersionInfo = process.versions.node.split('.').map(function (n) { return Number(n) })
if (nodeVersionInfo < curVer) {
    console.error(nodeVersionInfo + " is smaller than " + curVer);
} else {
    console.error(nodeVersionInfo + " is greater than " + curVer);
}

it prints me next:

$ node check.js
10,5,0 is smaller than 4,0,0

So, it's needed a totally different check of this, it's wrong logic as I see.

As temporary workaround for me, I have commented this wrong check, and electron-packager work fine now. For correctness, I'll try to write better and more accurate version check for this...

@Wohlstand
Copy link
Author

Okay, I have made the better check which is completely resolves this issue:

var curVer = [4, 0, 0];

function versionOlder(current, needed)
{
    for(var i = 0; i < current.length && i < needed.length; i++)
    {
        if(current[i] == needed[i])
            continue;
        return current[i] < needed[i];
    }
    return false;
}

var nodeVersionInfo = process.versions.node.split('.').map(function (n) { return Number(n) })
if (versionOlder(nodeVersionInfo, curVer)) {
    console.error(nodeVersionInfo + " is smaller than " + curVer);
} else {
    console.error(nodeVersionInfo + " is greater than " + curVer);
}

And output now

$ node check.js
10,5,0 is greater than 4,0,0

@Wohlstand
Copy link
Author

And the final code:

function versionOlder(current, needed) {
  for (var i = 0; i < current.length && i < needed.length; i++) {
    if (current[i] == needed[i])
      continue;
    return current[i] < needed[i];
  }
  return false;
}

var nodeVersionInfo = process.versions.node.split('.').map(function (n) { return Number(n) });
if (versionOlder(nodeVersionInfo, [4, 0, 0])) {
  console.error('CANNOT RUN WITH NODE ' + process.versions.node)
  console.error('Electron Packager requires Node 4.0 or above.')
  process.exit(1)
}

@Wohlstand
Copy link
Author

Wohlstand commented Jun 26, 2018

Okay, just now I checked your master branch, and I see you have already fixed it by using semver thing. Version of electron packager at me is 8.7.2 came with npm installation. So, everything must be fine. Sorry for disturbing.

@malept
Copy link
Member

malept commented Jun 26, 2018

For completeness, this was fixed in version 12.0.2. (Electron Packager does not come with NPM.)

tim-janik added a commit to tim-janik/beast that referenced this issue Oct 23, 2018
, closes #87

Pull nodejs-10 fix from Teteros:
  Simple version bump because electron-packager fails to run on Node 10+
  electron/packager#863

* update-electron-packager:
  EBEAST: Update electron-packager

Signed-off-by: Tim Janik <timj@gnu.org>
ankona added a commit to ankona/Brain.fm-Desktop-Client that referenced this issue Oct 24, 2018
@obendesmond

This comment has been minimized.

@pranayreddy123
Copy link

try to change "electron-packager": to "^12.1.0" in package,json

and run gradle info build.. so that you can see exact issue

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

No branches or pull requests

4 participants