electron / rebuild

Package to rebuild native Node.js modules against the currently installed Electron version
MIT License
1.03k stars 175 forks source link

Fails to build package on Windows #494

Open PalmerAL opened 3 years ago

PalmerAL commented 3 years ago

I'm trying to build keytar inside my Electron project in combination with Electron-packager, and I've configured my packaging script as described in the readme:

var baseOptions = {
  name: 'Min',
  dir: basedir,
  out: 'dist/app',
  electronVersion: electronVersion,
  appVersion: version,
  arch: 'all',
  ignore: ignoredDirs,
  prune: true,
  overwrite: true,
  afterCopy: [(buildPath, electronVersion, platform, arch, callback) => {
    rebuild({ buildPath, electronVersion, arch })
      .then(() => callback())
      .catch((error) => callback(error))
  }]
}

If I run this on macOS, it works, but on Windows (10 2004), I get the following error:

gyp: C:\Users\User\AppData\Local\Temp\electron-packager\win32-ia32\Min-win32-ia32\resources\app\node_modules\keytar\10.0.0\common.gypi not found (cwd: C:\Users\User\AppData\Local\Temp\electron-packager\win32-ia32\Min-win32-ia32\resources\app\node_modules\keytar) while reading includes of binding.gyp while trying to load binding.gyp

If I run npm rebuild directly in the repository, however, everything finishes successfully, so I'm assuming the actual node-gyp environment is set up correctly.

Is there anything else I can try to make rebuild work successfully?

PalmerAL commented 3 years ago

Actually, it works if I limit the package architectures to only the machine architecture (x64). So I guess this may be a general node-gyp issue after all - is there anything else that needs to be installed to make cross-architecture builds work?