Open phhoef opened 2 years ago
Can you think of any workaround?
The error above is thrown, when running electron-builder install-app-deps
. When running with --arch x64
flag it is working. The app will also work, when packaged as I am also packaging for x64. But in dev mode, it even won't start as the native dependency is built for the wrong architecture.
Is there a way to start start in dev mode with x64?
I don't know @phhoef 🙇
FWIW I worked through a similar issue while setting up builds in CI for windows. After googling around I found that the specific error you mentioned relating to openssl_fips
has something to do with Node 17 not including some configuration by default any more. Downgrading to 16 worked as a temporary fix:
https://github.com/nodejs/node-gyp/issues/2534 https://github.com/marktext/marktext/issues/2812
@todbot what node-gyp
PR fixed this?
It looks like node-gyp@^8.4.0
includes this potential fix https://github.com/nodejs/node-gyp/pull/2497 mentioned in https://github.com/nodejs/node-gyp/issues/2534#issuecomment-954978227
But I can see that @phhoef was reproducing with node-gyp@8.4.1
which came after.
In terms of workarounds I see,
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=''
-- https://github.com/nodejs/node-gyp/issues/2673#issuecomment-1196931379
Or modifying binding.gyp
to make the same change.
@MadLittleMods @phhoef seem like this is not exclusively an M1 issue. I get the same error on intel core i5 running node16`
errorOut=prebuild-install warn This package does not support N-API version 4.2.12
prebuild-install warn install No prebuilt binaries found (target=4.2.12 runtime=napi arch=x64 libc= platform=darwin)
gyp info it worked if it ends with ok
gyp info using node-gyp@9.1.0
gyp info using node@16.19.1 | darwin | x64
gyp info find Python using Python version 3.9.6 found at "/Library/Developer/CommandLineTools/usr/bin/python3"
gyp info spawn /Library/Developer/CommandLineTools/usr/bin/python3
gyp info spawn args [
gyp info spawn args '/Users/lukedarham/.nvm/versions/node/v16.19.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/Users/lukedarham/Documents/apps/idoru-desktop/node_modules/drivelist/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/lukedarham/.nvm/versions/node/v16.19.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/lukedarham/.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=/Users/lukedarham/.electron-gyp/4.2.12',
gyp info spawn args '-Dnode_gyp_dir=/Users/lukedarham/.nvm/versions/node/v16.19.1/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/lukedarham/.electron-gyp/4.2.12/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/lukedarham/Documents/apps/idoru-desktop/node_modules/drivelist',
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 '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.onCpExit (/Users/lukedarham/.nvm/versions/node/v16.19.1/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:284:16)
gyp ERR! stack at ChildProcess.emit (node:events:513:28)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
gyp ERR! System Darwin 21.6.0
gyp ERR! command "/Users/lukedarham/.nvm/versions/node/v16.19.1/bin/node" "/Users/lukedarham/.nvm/versions/node/v16.19.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/lukedarham/Documents/apps/idoru-desktop/node_modules/drivelist
gyp ERR! node -v v16.19.1
gyp ERR! node-gyp -v v9.1.0
gyp ERR! not ok
error Command failed with exit code 1.`
Do you guys find a fix for this? Im really stuck and not sure where to go from here.
No, I didn't found a solution for that problem.
My workaround is to remove usb-detection
as dependency. I am using serialport
for communication. I build a timer, that polls every few seconds for new devices through the serialport
lib.
Thanks for your reply. Do you mind sharing your code so there is an alternative on this thread.
The code is part of a bigger application, but I am trying to post the relevant code snips.
I am using redux
as state container.
I've also a button where the user can manually trigger a refresh of the serial port. So, the redux part was already in place, I've just added the timer as workaround. redux action:
export const getSerialports = () => async (dispatch) =>
{
const ports = await serialport.list();
dispatch({
type: SerialportTypeKeys.GET_SERIAL_PORTS,
ports
});
}
redux reducer: The reducer also preselects the first found serial port, if the user hasn't select one...
switch (action.type) {
case SerialportTypeKeys.GET_SERIAL_PORTS:
if (action.ports.length > 0) {
const selectedPort =
state.selectedPort === null
? action.ports[0]
: action.ports.find((p) => p.path === state.selectedPort.path);
return { ...state, ports: action.ports, selectedPort };
} else return { ...state, ports: action.ports, selectedPort: null };
}
In my index.tsx
I am calling the timer:
const store = configureStore();
const boundActions = bindActionCreators({ getSerialports }, store.dispatch);
let lastPorts = [];
const checkSerialPorts = async () => {
const ports = await SerialPort.list();
if (!equalPorts(lastPorts, ports)) boundActions.getSerialports();
lastPorts = ports;
setTimeout(checkSerialPorts, 2000);
};
checkSerialPorts();
I need to make this binding to the store, as I want to call the redux action.
You probably can reduce the complexity and only use the checkSerialPorts()
method.
I also needed a proper equals check to determine if an update of the available ports is necessary. Otherwise I would flood my redux store with unnecessary changes ...
export const equalPorts = (a: IPort[], b: IPort[]) => {
return (
Array.isArray(a) &&
Array.isArray(b) &&
a.length === b.length &&
a.every((val, index) => val.path === b[index].path)
);
};
Hope this helps 🙂
Thank you very much
On Fri, Mar 3, 2023 at 11:06 AM ph @.***> wrote:
The code is part of a bigger application, but I am trying to post the relevant code snips. I am using redux as state container.
I've also a button where the user can manually trigger a refresh of the serial port. So, the redux part was already in place, I've just added the timer as workaround. redux action:
export const getSerialports = () => async (dispatch) => {
const ports = await serialport.list();
dispatch({
type: SerialportTypeKeys.GET_SERIAL_PORTS, ports
}); }
redux reducer: The reducer also preselects the first found serial port, if the user hasn't select one...
switch (action.type) {
case SerialportTypeKeys.GET_SERIAL_PORTS: if (action.ports.length > 0) { const selectedPort = state.selectedPort === null ? action.ports[0] : action.ports.find((p) => p.path === state.selectedPort.path); return { ...state, ports: action.ports, selectedPort }; } else return { ...state, ports: action.ports, selectedPort: null };
}
In my index.tsx I am calling the timer:
const store = configureStore(); const boundActions = bindActionCreators({ getSerialports }, store.dispatch);
let lastPorts = []; const checkSerialPorts = async () => {
const ports = await SerialPort.list();
if (!equalPorts(lastPorts, ports)) boundActions.getSerialports();
lastPorts = ports;
setTimeout(checkSerialPorts, 2000); }; checkSerialPorts();
I need to make this binding to the store, as I want to call the redux action. You probably can reduce the complexity and only use the checkSerialPorts() method.
I also needed a proper equals check to determine if an update of the available ports is necessary. Otherwise I would flood my redux store with unnecessary changes ...
export const equalPorts = (a: IPort[], b: IPort[]) => {
return (
Array.isArray(a) && Array.isArray(b) && a.length === b.length && a.every((val, index) => val.path === b[index].path)
); };
Hope this helps 🙂
— Reply to this email directly, view it on GitHub https://github.com/MadLittleMods/node-usb-detection/issues/163#issuecomment-1453361784, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVPVRUTWUZNGHZPIRB4VBTW2HGDFANCNFSM5PX76JUA . You are receiving this because you commented.Message ID: @.***>
Unfortunately after trying the serialport
module I get the following error.
dyld[50034]: missing symbol called
phhoef did you experience this also?
Sony, not as far as I remember. i typically try to use the pre-builds if possible. probably asking the serialport guys, is a good idea
I am trying to re-compile
usb-detection
on an Apple M1 Mac. Unfortunately, I do get a errorAnybody can think how to workaround this?