Native code crashing electron - 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

Related

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

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

Installing plugins keeps failing because of es6-prepare-plugin

I am trying to prepare my iOS app and I need to get socialsharing and the whitelist plugin working, but they do not work. For example, when I do this:
sudo cordova plugin add cordova-plugin-x-socialsharing
I get this:
Installing "cordova-plugin-x-socialsharing" for android
Failed to install 'cordova-plugin-x-socialsharing':
CordovaError:
Failed to fetch plugin es6-promise-plugin via registry. Probably this
is either a connection problem, or plugin spec is incorrect. Check
your connection and plugin name/version/URL. Error: npm: Command
failed with exit code 1 Error output: npm ERR! code ENOLOCAL npm ERR!
Could not install from "node_modules/es6-promise-plugin" as it does
not contain a package.json file.
npm ERR!
How can I fix this? I tried everything. From sudo to non-sudo commands, but nothing is working for me. Adding es6-prepare-plugin manually does not work either.
My system information:
Cordova CLI: 7.0.1
Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic Framework Version: 1.3.3
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.1.0-beta.1
ios-deploy version: 1.9.0
ios-sim version: 5.0.8
OS: Mac OS X El Capitan
Node Version: v6.8.1
Xcode version: Xcode 8.3.3 Build version 8E3004b
PS: in my package.json file, I see this:
"es6-promise-plugin": "file:node_modules/es6-promise-plugin",
How can I change this?
Oh dear Lord. I found the answer I was looking for, after I've struggled for hours. This link on Github is the answer to this problem.
Seems like npm version 5.x.x does not work with some ionic-plugins. I downgraded to npm 4 using npm install -g npm#4.6.1 and installing this plugin worked for me afterwards.
Ionic is so buggy sometimes. Very annoying.

Not able to use Electron's webview on Windows

I have a simple react app. It uses:
react
webpack
redux
css-modules
Was looking for an easy way to wrap a React app into Electron.
Am trying out webview
Have a simple electron app
It works on OSX but not on Windows 10,
Please help.
It opens up the Electron app but nothing is visible in the webview
I have opened devtools in both the Electron renderer process and the webview,
but i do not see any error messages
I have tried:
electro-forge
electron and electron-packager
steps to run the app
install the global dependencies:
install node LTS ie. v6.9.2
install electron-forge with "npm install -g electron-forge"
run the React app:
git clone https://github.com/deepak/react-todo
cd react-todo
npm install
npm start
open "http://localhost:3000/todo" and "http://localhost:3000/" on the browser and checks that it works
run the Electron app:
git clone https://github.com/deepak/electron-webview-todo
cd electron-webview-todo
npm install
npm start (works on OSX but not windows 10)
we are using electron-forge here
try the same with plain Electron at the use-electron-packager-and-not-electron-forge branch
I was loading "http://0.0.0.0:3000"
It works when i load "http://localhost:3000/" instead

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.

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