node-gyp: npm ERR! gyp: name 'openssl_fips' is not defined
Solution: https://github.com/nodejs/node-gyp/issues/2673#issuecomment-1196931379
• electron-builder version=22.14.13
• rebuilding native dependencies dependencies=ffi-napi@4.0.3, ref-napi@3.0.3 platform=darwin arch=arm64
⨯ cannot execute cause=exit status 1
errorOut=npm ERR! code 1
npm ERR! path /Users/wks/Desktop/electron/terrasync/node_modules/ffi-napi
npm ERR! command failed
npm ERR! command sh -c node-gyp-build
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.0.0
npm ERR! gyp info using node@16.14.0 | darwin | arm64
npm ERR! gyp info find Python using Python version 3.8.9 found at “/Applications/Xcode.app/Contents/Developer/usr/bin/python3”
npm ERR! gyp info spawn /Applications/Xcode.app/Contents/Developer/usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args ‘/Users/wks/Desktop/electron/terrasync/node_modules/node-gyp/gyp/gyp_main.py’,
npm ERR! gyp info spawn args ‘binding.gyp’,
npm ERR! gyp info spawn args ‘-f’,
npm ERR! gyp info spawn args ‘make’,
npm ERR! gyp info spawn args ‘-I’,
npm ERR! gyp info spawn args ‘/Users/wks/Desktop/electron/terrasync/node_modules/ffi-napi/build/config.gypi’,
npm ERR! gyp info spawn args ‘-I’,
npm ERR! gyp info spawn args ‘/Users/wks/Desktop/electron/terrasync/node_modules/node-gyp/addon.gypi’,
npm ERR! gyp info spawn args ‘-I’,
npm ERR! gyp info spawn args ‘/Users/wks/.electron-gyp/11.5.0/include/node/common.gypi’,
npm ERR! gyp info spawn args ‘-Dlibrary=shared_library’,
npm ERR! gyp info spawn args ‘-Dvisibility=default’,
npm ERR! gyp info spawn args ‘-Dnode_root_dir=/Users/wks/.electron-gyp/11.5.0’,
npm ERR! gyp info spawn args ‘-Dnode_gyp_dir=/Users/wks/Desktop/electron/terrasync/node_modules/node-gyp’,
npm ERR! gyp info spawn args ‘-Dnode_lib_file=/Users/wks/.electron-gyp/11.5.0/<(target_arch)/node.lib’,
npm ERR! gyp info spawn args ‘-Dmodule_root_dir=/Users/wks/Desktop/electron/terrasync/node_modules/ffi-napi’,
npm ERR! gyp info spawn args ‘-Dnode_engine=v8’,
npm ERR! gyp info spawn args ‘–depth=.’,
npm ERR! gyp info spawn args ‘–no-parallel’,
npm ERR! gyp info spawn args ‘–generator-output’,
npm ERR! gyp info spawn args ‘build’,
npm ERR! gyp info spawn args ‘-Goutput_dir=.’
npm ERR! gyp info spawn args ]
npm ERR! gyp: name ‘openssl_fips’ is not defined while evaluating condition ‘openssl_fips != “”’ in …/node-addon-api/node_api.gyp while loading dependencies of binding.gyp while trying to load binding.gyp
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: gyp
failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/Users/wks/Desktop/electron/terrasync/node_modules/node-gyp/lib/configure.js:261:16)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:520:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Darwin 21.5.0
npm ERR! gyp ERR! command “/usr/local/bin/node” “/Users/wks/Desktop/electron/terrasync/node_modules/.bin/node-gyp” “rebuild”
npm ERR! gyp ERR! cwd /Users/wks/Desktop/electron/terrasync/node_modules/ffi-napi
npm ERR! gyp ERR! node -v v16.14.0
npm ERR! gyp ERR! node-gyp -v v9.0.0
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/wks/.npm/_logs/2022-06-01T07_14_18_457Z-debug-0.log
command=/usr/local/bin/node /usr/local/lib/node_modules/npm/bin/npm-cli.js rebuild ffi-napi@4.0.3 ref-napi@3.0.3
workingDir=
┌────────────────────────────────────────────────────────┐ │ electron-builder update check failed │ │ Try running with sudo or get access │ │ to the local update config store via │ │ sudo chown -R $USER:$(id -gn $USER) /Users/wks/.config │ └────────────────────────────────────────────────────────┘ npm ERR! code 1 npm ERR! path /Users/wks/Desktop/electron/terrasync npm ERR! command failed npm ERR! command sh -c electron-builder install-app-deps
npm ERR! A complete log of this run can be found in: npm ERR! /Users/wks/.npm/_logs/2022-06-01T07_14_16_686Z-debug-0.log
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 26 (6 by maintainers)
Commits related to this issue
- Pass openssl_fips as a variable to support building older node versions on newer node versions See https://github.com/nodejs/node-gyp/issues/2534 and https://github.com/nodejs/node-gyp/issues/2673 fo... — committed to ewanharris/node-ios-device by ewanharris a year ago
- Support Node.js 18 and 19 (#82) * Pass openssl_fips as a variable to support building older node versions on newer node versions See https://github.com/nodejs/node-gyp/issues/2534 and https://gith... — committed to tidev/node-ios-device by ewanharris a year ago
- Add support for Node 18 The Electron version we’re currently using is on Node 13 (?) but this is a step forward to upgrading to a newer Electron and Node version. Updates etcher-sdk and switches the... — committed to balena-io/etcher by dfunckt a year ago
- Add support for Node 18 The Electron version we’re currently using is on Node 13 (?) but this is a step forward to upgrading to a newer Electron and Node version. Updates etcher-sdk and switches the... — committed to balena-io/etcher by dfunckt a year ago
- Add support for Node 18 The Electron version we’re currently using is on Node 13 (?) but this is a step forward to upgrading to a newer Electron and Node version. Updates etcher-sdk and switches the... — committed to balena-io/etcher by dfunckt a year ago
- Add support for Node 18 The Electron version we’re currently using is on Node 14 but this is a step forward to upgrading to a newer Electron and Node version. Updates etcher-sdk and switches the red... — committed to balena-io/etcher by dfunckt a year ago
- Attempt to fix build error. See https://github.com/nodejs/node-gyp/issues/2673 — committed to sanosdole/nodeclrhost by sanosdole a year ago
- add openssl_fips variable to binding.gyp: https://github.com/nodejs/node-gyp/issues/2673 — committed to PrestonKnopp/tree-sitter-gdscript by PrestonKnopp a year ago
- Add openssl_fips to binding.gyp Fix this issue https://github.com/nodejs/node-gyp/issues/2673#issuecomment-1165324060 — committed to msotnikov/node-sqlite3 by msotnikov a year ago
- Fix build error with Electron https://github.com/nodejs/node-gyp/issues/2673 — committed to REVrobotics/node-expansion-hub-ftdi by NoahAndrews 8 months ago
I did not want to edit the binding.gyp file of a module that I was using. So I solved this problem by passing
"--openssl_fips=''"
into the script I want to use, likenpm install --openssl_fips=''
When using
yarn
it seems the--openssl_fips=''
passed toyarn
does not make a difference. If the issue happens in a dependency, editingbinding.gyp
in thenode_modules/
directory gets reverted automatically. I ended up with a workaround that edits gyp’s source code directly:The gyp source code location is printed in the error message:
gyp seems to evaluate the
binding.gyp
as a Python script, I changed the builtin variables to evaluate the script:The
input.py
is located in the node-gyp directory printed in the above error message, for example:/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py
~/.config/yarn/global/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py
Looking at https://github.com/nodejs/node-gyp/search?q=openssl_fips
In
binding.gyp
please try to add a line toWith Node 14 on Ubuntu 22.10, I solved this by downgrading
npm
to version 6 (npm install -g npm@6
). Noticed the issue started as soon as I updatednpm
to version 9. The project was usingyarn
.@arjunfulp You can avoid passing the flag in the
npm install
command by addingopenssl_fips
to the npm configuration:I had the same issue with Node14. The version below node17 does not seem to match node-gyp@9.0.0, downgrade node-gyp to version “v8.3.0”, the issue is solved for me.
根据找到的资料在binding.gyp也添加了 ‘variables’:{‘openssl_fips’:0}