Electron app do not start but electron-builder (dist) is ok - electron

Can't figure what's wrong in my electron project. Starting with electron . will fail with one native module (pkcs11js). See image :
But running npm run dist will build installer just fine, and running this installer work's fine and app is starting/workin like charm !
PS C:\Users\esa\devel\netauth\client> npm run dist
> Yubiconn2#1.0.0 dist C:\Users\esa\devel\netauth\client
> electron-builder -w --x64
• electron-builder version=21.2.0 os=10.0.18362
• loaded configuration file=package.json ("build" field)
• writing effective config file=dist\builder-effective-config.yaml
• rebuilding native dependencies dependencies=pkcs11js#1.0.18 platform=win32 arch=x64
• packaging platform=win32 arch=x64 electron=6.0.7 appOutDir=dist\win-unpacked
• building target=nsis file=dist\Yubiconn2 Setup 1.0.0.exe archs=x64 oneClick=true perMachine=false
• building block map blockMapFile=dist\Yubiconn2 Setup 1.0.0.exe.blockmap
and this was fine before today when I upgraded all outdated npm packages up-to-date. And nodejs too. This is Win10 env. My OsX env will work without any problem.
I have tried :
rm -rf node_modules; npm install
npm rebuild
even installing electron-rebuild and running .\node_modules\.bin\electron-rebuild
I understand electron-builder will rebuild all native dependencies for distribution. How to make same with development env (electron . or npm start)

I think you need to update node.js. See the part of your error about NODE_MODULE_VERSION
This explains the value of NODE_MODULE_VERSION https://nodejs.org/en/download/releases/#ref-1

Related

Cannot upgrade to expo SDK > 40 in terminal

So I am trying to submit a react native app with the eas/expo commands in the prompt. I have deleted and re-installed node, npm, eas, and expo many times, yet when I am doing the "eas build" command it still says I should have expo SDK > 40 for it to work.
when I do the "node --version" command it says v16.15.1
it says "eas-cli/0.53.1 darwin-x64 node-v16.15.1" for eas version
5.4.9 for expo version
8.11.0 for npm version
I have been running these commands to update them:
"npm install -g npm#latest
npm install --global expo-cli#44 (I tried many version)
sudo npm i -g expo-cli
n stable
n latest. "
Any guidance is greatly appreciated on how to get my current version to > 40.
Best Regards,
Evan
This refers to the Expo SDK version in package.json files as below
//...other packages...
"color": "4.0.1",
"expo": "^43.0.0", <= Expo SDK version
"expo-av": "~10.1.3",
Check the app Expo SDK version, if lower than 40, you need to upgrade it to your preferred version.
Upgrade instruction - https://docs.expo.dev/workflow/upgrading-expo-sdk-walkthrough

Is it possible(if yes, what is the best way) to build electron app having node-hid as a dependency on linux using docker for windows 32bit?

Using docker image electronuserland/builder:wine trying to build:
./node_modules/.bin/electron-builder --win --ia32
outputs:
• loaded configuration file=/project/electron-builder.yml
• writing effective config file=build/builder-effective-config.yaml
• rebuilding native dependencies dependencies=node-hid#2.1.1, sqlite3#4.2.0, usb-detection#4.10.0 platform=win32 arch=ia32
• install prebuilt binary name=usb-detection version=4.10.0 platform=win32 arch=ia32
• install prebuilt binary name=node-hid version=2.1.1 platform=win32 arch=ia32
⨯ cannot build native dependency reason=prebuild-install failed with error and build from sources not possible because platform or arch not compatible
cause=exit status 1
errorOut=prebuild-install info begin Prebuild-install version 5.3.6
prebuild-install WARN install prebuilt binaries enforced with --force!
prebuild-install WARN install prebuilt binaries may be out of date!
prebuild-install info looking for cached prebuild # /root/.npm/_prebuilds/c5dfd1-node-hid-v2.1.1-electron-v76-win32-ia32.tar.gz
prebuild-install http request GET https://github.com/node-hid/node-hid/releases/download/v2.1.1/node-hid-v2.1.1-electron-v76-win32-ia32.tar.gz
prebuild-install http 404 https://github.com/node-hid/node-hid/releases/download/v2.1.1/node-hid-v2.1.1-electron-v76-win32-ia32.tar.gz
prebuild-install WARN install No prebuilt binaries found (target=8.1.1 runtime=electron arch=ia32 libc= platform=win32)
command=/usr/local/bin/node /project/node_modules/prebuild-install/bin.js --platform=win32 --arch=ia32 --target=8.1.1 --runtime=electron --verbose --force
workingDir=/project/node_modules/node-hid
What am I missing? Or is it actually required in this case to build app on windows machine?

Unable to resolve module react/lib/ReactUpdates

I'm cloning a proyect:
The steps are:
npm i
react-native link
When i run it react-native run-ios i have a problem with RCTWebSocket library. This problem is easy to resolve if you search a little just need remove 2 compiler flags, in Custom Compiler Flags.
Later just i run again react-native run-ios and works fine, but when the app is open, show the next error:
Searching i found that is related to upgrade, source here
but i'm using that command and not works.
When this command is executed, it starts showing me some overrides to some files and at the end of this process, the problem persists.
My react info:
react-native-cli: 1.0.0
react-native: 0.32.1
I'm running in Xcode 8 and ios 10.0
PDTA: When I start a new project works perfect
UPDATES:
When clone on another mac works, I am ensuring to have the same versions of both xcode and node.
Could it be some mac configuration problem?
The only difference between the 2 macs is the cli version:
`react-native-cli: 1.1.0` --> my mac
`react-native-cli: 1.2.0` --> the other mac
Will this be enough to cause all this problem?
With React 0.32~0.37: The problem is most likely that you are using React 15.4.x instead of 15.3.x. One of the changes between 15.3 and 15.4 was that many of the modules under react/lib were moved to react-dom/lib, which is why the packager can't find react/lib/ReactUpdates.
Ensure that your package.json file locks React to 15.3.x:
"dependencies": {
"react": "~15.3.2"
}
Then delete your node_modules folder and run yarn or npm install again. Verify that you installed React 15.3.x:
$ npm ls react
app#1.0.0 /code/app
└── react#15.3.2
Last, restart the React Native server and load your bundle again.
This has been fixed!
Update your dependencies and use react-native ^0.38.0 or newer.
Run react-native upgrade after all react-native version upgrades.

Native code crashing electron

Electron version: 0.37.5.
Operating system: OSX 10.11.4
I'm using the X509 (https://www.npmjs.com/package/x509) module which works fine outside of electron. I suspect it could be due to the underlying dependance on openssl.
I followed the instructions here https://github.com/electron/electron/blob/master/docs/tutorial/using-native-node-modules.md to but the module is still crashing electron.
npm install --save-dev electron-rebuild
# Every time you run "npm install", run this
./node_modules/.bin/electron-rebuild
# On Windows if you have trouble, try:
.\node_modules\.bin\electron-rebuild.cmd

Cordova throws syntax error when trying to add platform

I'm trying to install Cordova and Ionic Framework on a Ubuntu server. I already used Node.js on it, so simply ran:
sudo npm install -g cordova
Then I cloned a sample project from GitHub
sudo git clone https://github.com/driftyco/ionic-weather.git
I entered the directory and tried to add the iOS platform library in order to build it:
cd ionic-weather
sudo cordova platform add ios
However it throws the following error:
Creating ios project...
/home/benedict/.cordova/lib/ios/cordova/3.4.0/bin/create: 33: /home/benedict/.cordova/lib/ios/cordova/3.4.0/bin/create: Syntax error: "(" unexpected
Error: /home/benedict/.cordova/lib/ios/cordova/3.4.0/bin/create: Command failed with exit code 2
at ChildProcess.whenDone (/usr/lib/node_modules/cordova/src/superspawn.js:112:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:743:16)
at Process.ChildProcess._handle.onexit (child_process.js:810:5)
I've tried reinstalling Cordova in case something got corrupted, but no luck. I can't seem to find anyone else with this issue either so I'm kinda stuck. Any ideas?
This turned out to be a combination of several problems:
Ant is a required dependency, although it's not documented as a dependency as far as I can tell from any of the install guides the ionic guide or cordova guide point to. In fact I found this out by digging around SO and a few other dark corners of the internet
JDK must also be installed. (not just JRE)
2 folders have to be added to the path (for Android anyways).
Ant
This can be installed via sudo apt-get install ant.
jdk
sudo update-alternatives --config java
first, you can find out if you have jdk by running `sudo update-alternatives --get-selections | grep ^java
if you already have the jdk, you can update your jre to the jdk version using sudo update-alternatives --config java
if not, then install jdk (not just the jre), using sudo apt-get install openjdk-7-jdk
Path setting in ~/.bashrc
$ cd ~
$ sudo vi .bashrc
at the bottom, before the PATH= add the path to the bundle folders for both platform-tools folder and the tools folder under the sdk folder. Several of the guides only mention the platform-tools folder.
The guide specifically mentions ios can't be installed on Windows, but strangely leaves out Linux. This may be an oversight, but I can't be sure. There was some indication in the ionic guides that ios emulation could be done on linux, even though actual development could only be done on OSx.
the ios platform requires xcode 4.5 with cordova, which needs OSx 10.7 you basically can't add the ios platform tools on Windows or Linux. Unfortunately cordova and ionic both seem to forget Linux exists, and therefore the docs imply this will run on Linux when they note inoperability on Windows but say nothing about Linux.
Your problem is that your trying to build the app on a machine that doesnt have Mac OS installed. In order to add IOS platform you need to run this command on a mac.
Check the Prerequisites here:
http://docs.phonegap.com/en/3.0.0/guide_cli_index.md.html

Resources