Failed to compile to app installer, @serialport/bindings-cpp and node-gyp error

88 views Asked by At

My configuration:

Node Version: v20.10.0 Platform: Windows 10 22H2 64bit Compiler: Visual Studio Community 2019 (executed npm config set msvs_version 2019 and try 2017 too ) Module: serialport / @Serialport/Bindings-cpp
Python: 3.7.5

Hello, I have been struggling with this issue for quite some time at this point so any help would be greatly appreciated.

I have noticed whenI test/debug my application, it's working well. but when I try to compile to get an application installer with electron-builder. During the compilation I seem to be having trouble between @serialport/bindings-cpp and node-gyp.

In my initial package.json, serialport use the version 9.0.0 I try to upgrade to the version 10. but the problem is always there.

here is an extract of my package.json :

"devDependencies": {
    "@babel/plugin-proposal-decorators": "^7.0.0-rc.1",
    "babel-core": "^6.26.3",
    "babel-loader": "^7.1.4",
    "babel-plugin-transform-decorators-legacy": "^1.3.5",
    "babel-preset-react-native": "^4.0.1",
    "css-loader": "^3.5.3",
    "electron": "^4.0.1",
    "electron-builder": "^22.14.5",
    "electron-reload": "^1.5.0",
    "extract-text-webpack-plugin": "^4.0.0-beta.0",
    "file-loader": "^1.1.10",
    "npm-run-all": "^4.1.2",
    "webpack": "^4.28.4",
    "webpack-cli": "^3.2.1"
  },
  "dependencies": {
    "@material-ui/core": "^4.11.0",
    "@serialport/parser-inter-byte-timeout": "^10.0.0",
    "@trendmicro/react-sidenav": "^0.5.0",
    "@types/react": "^16.7.20",
    "babel-polyfill": "^6.26.0",
    "babel-preset-env": "^1.7.0",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-react": "^6.24.1",
    "babel-preset-stage-2": "^6.24.1",
    "baseconvert": "1.0.0",
    "bootstrap": "^4.4.1",
    "canvasjs-react-charts": "1.0.5",
    "create-react-class": "^15.6.3",
    "dotenv": "^6.2.0",
    "enzyme": "^3.8.0",
    "flow-bin": "^0.91.0",
    "hex2ascii": "0.0.3",
    "js-crc": "0.2.0",
    "mobx": "^5.8.0",
    "mobx-decorators": "^5.0.3",
    "mobx-react": "^5.4.3",
    "node-gyp": "^10.0.1",
    "object-sizeof": "1.6.1",
    "rc-checkbox": "2.1.6",
    "react": "^16.13.1",
    "react-bootstrap": "^0.32.4",
    "react-charts": "2.0.0-beta.7",
    "react-dom": "^16.7.0",
    "react-popup": "^0.9.3",
    "react-select": "^2.3.0",
    "react-tooltip": "^3.9.2",
    "serialport": "^10.0.0"
  },

And here is an extract of the issue :

electron-builder  version=22.14.13 os=10.0.19045
  • loaded configuration  file=package.json ("build" field)
  • writing effective config  file=dist\builder-effective-config.yaml
  • rebuilding native dependencies  dependencies=@serialport/[email protected] platform=win32 arch=ia32
  • rebuilding native dependency  name=@serialport/bindings-cpp version=10.8.0
  ⨯ cannot execute  cause=exit status 1
$ node-gyp-build

info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

warning ..\..\..\package.json: No license field
    gyp info it worked if it ends with ok
    gyp info using [email protected]
    gyp info using [email protected] | win32 | ia32
    gyp info find Python using Python version 3.7.5 found at "C:\Users\xxx\AppData\Local\Programs\Python\Python37\python.exe"
    gyp info find VS using VS2019 (16.11.34301.259) found at:
    gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
    gyp info find VS run with --verbose for detailed information
    gyp info spawn C:\Users\xxx\AppData\Local\Programs\Python\Python37\python.exe
    gyp info spawn args [
    gyp info spawn args 'C:\\LDM Bord\\node_modules\\node-gyp\\gyp\\gyp_main.py',
    gyp info spawn args 'binding.gyp',
    gyp info spawn args '-f',
    gyp info spawn args 'msvs',
    gyp info spawn args '-I',
    gyp info spawn args 'C:\\LDM Bord\\node_modules\\@serialport\\bindings-cpp\\build\\config.gypi',
    gyp info spawn args '-I',
    gyp info spawn args 'C:\\LDM Bord\\node_modules\\node-gyp\\addon.gypi',
    gyp info spawn args '-I',
    gyp info spawn args 'C:\\Users\\xxx\\.electron-gyp\\4.2.12\\include\\node\\common.gypi',
    gyp info spawn args '-Dlibrary=shared_library',
    gyp info spawn args '-Dvisibility=default',
    gyp info spawn args '-Dnode_root_dir=C:\\Users\\xxx\\.electron-gyp\\4.2.12',
    gyp info spawn args '-Dnode_gyp_dir=C:\\LDM Bord\\node_modules\\node-gyp',
    gyp info spawn args '-Dnode_lib_file=C:\\\\Users\\\\xxx\\\\.electron-gyp\\\\4.2.12\\\\<(target_arch)\\\\node.lib',
    gyp info spawn args '-Dmodule_root_dir=C:\\LDM Bord\\node_modules\\@serialport\\bindings-cpp',
    gyp info spawn args '-Dnode_engine=v8',
    gyp info spawn args '--depth=.',
    gyp info spawn args '--no-parallel',
    gyp info spawn args '--generator-output',
    gyp info spawn args 'C:\\LDM Bord\\node_modules\\@serialport\\bindings-cpp\\build',
    gyp info spawn args '-Goutput_dir=.'
    gyp info spawn args ]
    gyp: name 'openssl_fips' is not defined while evaluating condition 'openssl_fips != ""' in binding.gyp while trying to load binding.gyp
    gyp ERR! configure error
    gyp ERR! stack Error: `gyp` failed with exit code: 1
    gyp ERR! stack at ChildProcess.<anonymous> (C:\LDM Bord\node_modules\node-gyp\lib\configure.js:271:18)
    gyp ERR! stack at ChildProcess.emit (node:events:514:28)
    gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12)
    gyp ERR! System Windows_NT 10.0.19045
    gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\LDM Bord\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
    gyp ERR! cwd C:\LDM Bord\node_modules\@serialport\bindings-cpp
    gyp ERR! node -v v20.10.0
    gyp ERR! node-gyp -v v10.0.1
    gyp ERR! not ok
error Command failed with exit code 1.

                    command='C:\Program Files (x86)\nodejs\node.exe' 'C:\Users\xxx\AppData\Roaming\npm\node_modules\yarn\bin\yarn.js' run install
                    workingDir=C:\LDM Bord\node_modules\@serialport\bindings-cpp

Steps I have taken to resolve:

  • Uninstall and reinstall Node multiple times with multiple versions
  • Uninstall and reinstall windows-build-tools and Microsoft Visual Stuio community multiple times with multiple versions (2017 or 2019)
  • Update node-gyp (actual version is 10.0.1), I installed it in global or in local.
  • Uninstall and reinstall python multiple times with multiple versions.

I know everything was working fine last year. Any suggestions would be very much appreciated. Also, happy to provide any additional information that I did not think to add.

0

There are 0 answers