question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Electron with ffi-napi npm start fails with node-gyp error code

See original GitHub issue
  • Node Version: node 17.0.1 and npm 8.1.2
  • Platform: Windows 10, 10.0.19042 64bit
  • Module: ffi-napi
  • Visual studio: Visual Studio Community 2019 (executed npm config set msvs_version 2019)
  • Python: Python 3.10.0

Created an app following these instructions https://www.electronforge.io/guides/framework-integration/react Added npm install ffi-napi

npm start fails on Preparing native dependencies with the error:

| Preparing native dependencies: 0 / 1gyp: name 'openssl_fips' is not defined while evaluating condition 'openssl_fips != ""' in binding.gyp while trying to load binding.gyp
× Preparing native dependencies: 0 / 1

An unhandled error has occurred inside Forge:
node-gyp failed to rebuild 'C:\projects\gyp-bug-reproduce\node_modules\ffi-napi'.
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:\projects\gyp-bug-reproduce\node_modules\ffi-napi'.
For more information, rerun with the DEBUG environment variable set to "electron-rebuild".

Error: `gyp` failed with exit code: 1

The example to reproduce is here https://github.com/topheroes/gyp-bug-reproduce

Please advise

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
topheroescommented, Nov 5, 2021

@richardlau Downgrading Node to 16.13.0 helped

2reactions
noseratiocommented, Mar 18, 2022

I just spent my day solving this. Eventually, here’s what has worked for me (also on SO ):

  • install the latest node-gyp locally:

    npm install -d node-gyp@latest
    
  • in binding.gyp, add (at the top):

    {
        "variables": {
            "openssl_fips" : "0" 
        },
    
        ...      
    }
    
Read more comments on GitHub >

github_iconTop Results From Across the Web

Why does npm install ffi return error. Using node version 12
I am trying to call c++ API in a dll from node-js. So far I found that ffi can be used to do...
Read more >
electron-node-ffi - npm
node -ffi-napi is a Node.js addon for loading and calling dynamic libraries using pure JavaScript. It can be used to create bindings to...
Read more >
Debugging "Make Failed with Exit Code 2" Error - CodeForGeek
Try re-installing node-gyp again. npm i -g node-gyp. You may require sudo access depending upon your node installation. Debug #4: Update Node ...
Read more >
A Comprehensive Guide to Fixing Node-Gyp Issues on Windows
1. Try running npm install with the --no-optional flag. ... If you're lucky, the dependency that requires node-gyp will be optional, and you...
Read more >
[SOLVED] Node-gyp error, node_modules does not get ...
npm ERR ! code 1 npm ERR! path C:\Users\user\programming projects\mflix-js\node_modules\weak-napi npm ERR! command failed npm ERR! command ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found