electron/packager

Cannot run with Node 10

mattridley opened this issue Β· 21 comments

When packaging my electron app with Node 10 I get the following error in the console.

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

In cli.js the check evaluates to [10, 0, 0] < [4, 0, 0] which is true, whereas previously [9, 0, 0] returns as false.

I'll raise a PR now to simplify this check so it continues to work with newer versions of node.

πŸ‘‹ 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.

Any solution yet? Do we have to downgrade to node 4.x?

@Joni4Games It is patched. Just use the latest 9.x release until the fix is published.

Thanks for your patience, a fix has been released in 12.0.2.

well, i'm using version 12.1.0 and issue remains the same

@psharneja I cannot reproduce this. My steps (on Linux):

# step 0: install nodeenv <https://github.com/ekalinin/nodeenv>
nodeenv -n 10.2.1 node10
source node10/bin/activate
git clone https://github.com/electron-userland/electron-packager
cd electron-packager
npm install
./cli.js --version

My output:

Electron Packager 12.1.0
Node v10.2.1
Host Operating system: linux (x64)

On my system the issue also appears to be fixed in 12.1.0.

I am beginning to learn about Electron through the electron-api-demos app. When trying to run npm run-script package I also get this error.

I am running the following versions:

  • Node: 10.4.1
  • electron-packager: 12.1.0
  • macOS 10.13.5

@jsejcksn if you run npm run package -- --version and it doesn't immediately print out the Electron Packager version and exit, you don't have Electron Packager 12.1.0 installed. In that case, run npm update.

Hi @malept: Thanks for responding. Running your example command produces an error:

$ npm run-script package -- --version

> ElectronAPIDemos@1.3.0 package /path/to/electron-api-demos
> npm-run-all package:* "--version"

ERROR: Invalid Option: --version

I thought I was running v 12.1.0 of electron-packager because of the output of npm view electron-packager version. However, I realized my mistakeβ€”that it is showing me the info for the package at the npm registry and not my local package. I then ran npm list electron-packager, which produced

ElectronAPIDemos@1.3.0 /path/to/electron-api-demos
└── electron-packager@8.7.2

Running npm update or npm update electron-packager will not increase the installed version of electron-packager because of the use of the ^ in package.json. The caret prohibits updating it beyond the major version number, in this case, 8.x.x.

I see that you are also a member of the electron-api-demos repo. Perhaps you can address this issue there by changing the ^ to >=? As it stands, users cannot install and test packaging the app when running the latest version of Node.

I see that you are also a member of the electron-api-demos repo.

I am a member but not an active contributor.

Perhaps you can address this issue there by changing the ^ to >=?

That seems like a bad idea, because when I increment the major version number, I do so deliberately - per the semantic versioning spec, that's when command line flags can get removed, which can break someone's usage of the CLI. It would be better if someone just version bumped Electron Packager in package.json.

@malept I agree about semver practices, however, there may be another internal reason (unknown to me) not to bump the required major version, which is why I suggested a different operator instead. Which member do you suggest I contact about this since you are unable to address it?

You should just file a pull request instead of contacting someone.

@malept So there are no reasons the package is still set to major version 8? Nothing would prohibit the team from accepting a PR to bump it to 12?

I don't know the answer to that without looking at the project.

Issue still persists:

$ node --version
v10.11.0

$ npm list electron-packager
buymeapie@ /Users/snaky/Dev/baton/baton.web.app.git
└── electron-packager@12.1.2

$ electron-packager 
CANNOT RUN WITH NODE 10.11.0
Electron Packager requires Node 4.0 or above.

MacOs 10.13.6

Node is installed with brew.

@lukyanov You have an old version installed globally, that's what's running when you just run electron-packager. Try node_modules/.bin/electron-packager instead, which will run the version installed relative to your Node app (assuming you're in the root directory of your Node app). (You should uninstall the globally installed version so you're not confused.)

Is Node 11 going to be supported soon? (It was released 3 months ago)

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

Still broken with node 10.11.0 which is the official version used by electron 4.0.0

@rmraya

First, the version bundled with Electron has no bearing on the version of Node that is required by Electron Packager to run, unless for some bizarre reason you're using Electron itself to run Electron Packager.

Second, as I mentioned several times in this issue: the bug has been fixed in 12.0.2 and above.

I'm locking this issue because this is becoming unproductive for me.

To reiterate for users who think they cannot run Electron Packager with the latest version of Electron Packager:

If you installed Electron Packager in your project (recommended over installing globally):

  • On Windows, in your project directory, run node_modules\.bin\electron-packager --version
  • On all other platforms, in your project directory, run node_modules/.bin/electron-packager --version

If that command doesn't print out the version number of Electron Packager, your globally installed version of Electron Packager is too old.

If you installed Electron Packager globally: run electron-packager --version. If that doesn't print out the version number of Electron Packager, your globally installed version of Electron Packager is too old.

If you still run into this and you have double-checked that all versions of Electron Packager on your system and projects are 12.0.2 or greater, please file a new issue, making sure to fill out the issue template, and mention the Electron Packager version you installed.