Node.js v22.14.0 compatibility issue with electron-forge import command

I’m having trouble setting up electron-forge in my project. When I try to run the import command, it fails with a Node.js compatibility error.

My setup:

  • Windows 10 64-bit
  • Node.js v22.14.0
  • npm v11.2.0
  • fnm v1.38.1

The error I get:

C:\Projects\electron-demo>npx electron-forge import
✓ Checking your system
✓ Locating importable project  
> Processing configuration and dependencies
  ✓ Resolving package manager: npm
  ✗ Installing dependencies
    › Failed to install modules: ["electron-squirrel-startup"]

    npm WARN npm npm does not support Node.js v22.14.0
    npm WARN npm You should probably upgrade to a newer version of node
    npm WARN npm Supported releases are latest of 6, 8, 9, 10, 11, 12
    npm ERR! cb.apply is not a function

Current package.json:

{
  "devDependencies": {
    "@electron-forge/cli": "^7.8.0",
    "electron": "^35.0.3"
  }
}

I installed Node.js v22 LTS using fnm and updated npm from 10.9.2 to 11.2.0 thinking the older version was causing issues. I also tried removing global npm packages but still getting the same error. Has anyone encountered this compatibility problem before?

Yeah, that cb.apply error is a known bug with npm 11.x and electron-squirrel-startup. Hit the same thing two months back during a migration. npm 11 broke backward compatibility with older callback patterns that electron-squirrel-startup still relies on. Skip the downgrade suggestions - here’s what actually worked for me. Use Yarn for the electron-forge import instead. Install it globally: npm install -g yarn, then run yarn electron-forge import. Yarn handles dependencies differently and sidesteps the callback issues entirely. If you’re stuck on npm, drop to version 10.8.3 specifically - tested multiple versions and this one plays nicest with electron-forge 7.8.0. You can bump npm back up once the import finishes.

had the same issue last week. npm 11.2.0 is buggy with certain packages. downgrade npm to 10.x with npm install -g npm@10 and keep node 22. fixed it for me without touching node versions.

This isn’t really an electron-forge issue - it’s npm compatibility. I hit the same thing when I jumped to Node 22 too early. The npm version that ships with Node 22.14.0 doesn’t play nice with some packages electron-forge needs.

Just downgrade to Node 20 LTS for now. Most Electron tooling is tested against that version anyway. If you’re using fnm, run fnm use 20 or fnm install 20 && fnm use 20. Node 22’s still pretty new and the Electron ecosystem hasn’t caught up yet.

Once you’re on Node 20, delete your node_modules and package-lock.json, then try the electron-forge import again. Fixed it for me when I had the same module installation failures.