electron/rebuild

'openssl_fips' is not defined while evaluating condition 'openssl_fips != ""'

jakobrosenberg opened this issue · 6 comments

After creating an Ubuntu 20 instance on AWS Lightsail, I'm unable to use electron-rebuild.

Running

npm init
npm install serialport
npm install electron-rebuild
npx electron-rebuild -v 9.4.4

will produce the following error

⠧ Building module: bindings, Completed: 0gyp: name 'openssl_fips' is not defined while evaluating condition 'openssl_fips != ""' in binding.gyp while trying to load binding.gyp
✖ Rebuild Failed

I have same issue too.
Here is detail error messages. (Actually, I can't say that it's detailed. Cause I can get little data from error messages.)

yarn run v1.22.15
$ electron-rebuild -f -w myapp
\ Building module: bindings, Completed: 0gyp: name 'openssl_fips' is not defined while evaluating condition 'openssl_fips 
!=""' in binding.gyp while trying to load binding.gyp
× Rebuild Failed

An unhandled error occurred inside electron-rebuild
node-gyp failed to rebuild 'C:\Users\node_modules\@serialport\bindings'.
For more information, rerun with the DEBUG environment variable set to "electron-rebuild".

Error: `gyp` failed with exit code: 1



Error: node-gyp failed to rebuild 'C:\Users\node_modules\@serialport\bindings'.
For more information, rerun with the DEBUG environment variable set to "electron-rebuild".

Error: `gyp` failed with exit code: 1


    at NodeGyp.rebuildModule (C:\Users\node_modules\electron-rebuild\lib\src\module-type\node-gyp.js:109:19)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async ModuleRebuilder.rebuildNodeGypModule (C:\Users\node_modules\electron-rebuild\lib\src\module-rebuilder.js:94:9)
    at async Rebuilder.rebuildModuleAt (C:\Users\node_modules\electron-rebuild\lib\src\rebuild.js:226:9)
    at async Rebuilder.rebuild (C:\Users\node_modules\electron-rebuild\lib\src\rebuild.js:184:17)
    at async C:\Users\node_modules\electron-rebuild\lib\src\cli.js:154:9
error Command failed with exit code 4294967295.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

We encountered this issue on both local development and GitHub Action.

➜ web git:(master) yarn dev-electron-app
$ electron-forge start
✔ Checking your system
✔ Locating Application
⠧ Preparing native dependencies: 0 / 1gyp: name 'openssl_fips' is not defined while evaluating condition 'openssl_fips != ""' in binding.gyp while trying to load bin
ding.gyp
✖ Preparing native dependencies: 0 / 1

An unhandled error has occurred inside Forge:
node-gyp failed to rebuild '/Users/tiensonqin/Codes/projects/logseq/web/static/node_modules/better-sqlite3'.
For more information, rerun with the DEBUG environment variable set to "electron-rebuild".

Error: gyp failed with exit code: 1

Error: node-gyp failed to rebuild '/Users/tiensonqin/Codes/projects/logseq/web/static/node_modules/better-sqlite3'.
For more information, rerun with the DEBUG environment variable set to "electron-rebuild".

Error: gyp failed with exit code: 1

at NodeGyp.rebuildModule (/Users/tiensonqin/Codes/projects/logseq/web/static/node_modules/@electron-forge/core/node_modules/electron-rebuild/src/module-type/node

-gyp.ts:120:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at ModuleRebuilder.rebuildNodeGypModule (/Users/tiensonqin/Codes/projects/logseq/web/static/node_modules/@electron-forge/core/node_modules/electron-rebuild/src/m
odule-rebuilder.ts:93:5)
at Rebuilder.rebuildModuleAt (/Users/tiensonqin/Codes/projects/logseq/web/static/node_modules/@electron-forge/core/node_modules/electron-rebuild/src/rebuild.ts:2
99:5)
at Rebuilder.rebuild (/Users/tiensonqin/Codes/projects/logseq/web/static/node_modules/@electron-forge/core/node_modules/electron-rebuild/src/rebuild.ts:200:9)
at /Users/tiensonqin/Codes/projects/logseq/web/static/node_modules/@electron-forge/core/src/util/rebuild.ts:32:5
error Command failed with exit code 1.

Updated, bumping to v3.2.5 works for me.

Updated, bumping to v3.2.5 works for me.

Electron-rebuild v3.2.5 works for me.
The problem was solved. Thank you.

logseq

Oh, what a coincidence, that's what I'm also trying to build. This exact issue is back, on 3.2.5.

npx electron-rebuild
⠇ Building module: better-sqlite3, Completed: 0gyp: name 'openssl_fips' is not defined while evaluating condition 'openssl_fips != ""' in binding.gyp while trying to load binding.gyp
✖ Rebuild Failed

An unhandled error occurred inside electron-rebuild
node-gyp failed to rebuild '/Users/paul/Documents/Code/Logseq/logseq/static/node_modules/better-sqlite3'.
For more information, rerun with the DEBUG environment variable set to "electron-rebuild".

Error: `gyp` failed with exit code: 1



Error: node-gyp failed to rebuild '/Users/paul/Documents/Code/Logseq/logseq/static/node_modules/better-sqlite3'.
For more information, rerun with the DEBUG environment variable set to "electron-rebuild".

Error: `gyp` failed with exit code: 1


    at NodeGyp.rebuildModule (/Users/paul/Documents/Code/Logseq/logseq/static/node_modules/electron-rebuild/lib/src/module-type/node-gyp.js:117:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async ModuleRebuilder.rebuildNodeGypModule (/Users/paul/Documents/Code/Logseq/logseq/static/node_modules/electron-rebuild/lib/src/module-rebuilder.js:94:9)
    at async ModuleRebuilder.rebuild (/Users/paul/Documents/Code/Logseq/logseq/static/node_modules/electron-rebuild/lib/src/module-rebuilder.js:124:14)
    at async Rebuilder.rebuildModuleAt (/Users/paul/Documents/Code/Logseq/logseq/static/node_modules/electron-rebuild/lib/src/rebuild.js:145:13)
    at async Rebuilder.rebuild (/Users/paul/Documents/Code/Logseq/logseq/static/node_modules/electron-rebuild/lib/src/rebuild.js:108:17)
    at async /Users/paul/Documents/Code/Logseq/logseq/static/node_modules/electron-rebuild/lib/src/cli.js:154:9

I'm using an ARM (M1) Mac with macOS 12.3.1 and node 18.

Okay, as mentioned in marktext/marktext#2812 and other places downgrading to Node 16 is a possible workaround.