SIGTRAP when starting electron on WSL2 - npm

I followed various online steps in Github forums and blogs to install VcsXsrv so that I could run an electron app through WSL for development. But I have been stuck on the following error when running yarn start:
/home/me/dev/my-electron-app-2/node_modules/electron/dist/electron exited with signal SIGTRAP
Specs:
AMD Radeon R9 380 Series
Windows 10 Pro Build 19044.1826 (3/23/21)
VcsXsrv installed (1.20.14.0)
WSL2 (latest) for Ubuntu 18.04
Dev Setup:
Node 16.15.0
Npm 8.5.5
package.json
{
"name": "myapp",
"version": "1.0",
"description": "My Desktop App",
"main": "main.js",
"scripts": {
"start": "electron .",
},
"author": "Me",
"license": "Apache-2.0",
"dependencies": {
"compromise": "^13.11.1",
"compromise-numbers": "^1.3.0",
"compromise-sentences": "^0.3.0",
"electron": "^19.0.8"
},
"devDependencies": {
"electron-packager": "^15.2.0"
}
}
Steps Tried:
Updating from Electron 15 to 19
Clearing package-lock.json
Making sure VcsXsrv was not blocked by firewall (public/private)
Updating WSL from 1 to 2

What did it I think was following this tutorial, specifically installing those missing libraries: https://www.beekeeperstudio.io/blog/building-electron-windows-ubuntu-wsl2
Incomplete list of libraries needed for electron/WSL Xserver usage:
libnss3-dev
libgdk-pixbuf2.0-dev
libgtk-3-dev
libxss-dev
libasound2
libgconf-2-4
libatk1.0-0
Related questions that were useful:
General setup: How to set up working X11 forwarding on WSL2
Similar fault: Electron not starting properly due to SIGTRAP
Another similar fault: Electron in Docker: SIGTRAP, ELIFECYCLE, errno1
WSL issue: https://github.com/microsoft/WSL/issues/6430
Another setup guide: https://gist.github.com/caseywatts/9700b402b6b51d1d6af9f0b206739770

Related

Requiring unknown module "11" error on iOS simulator

When I run the react native project with react-native run-ios.It shows the following error on my iOS simulator.On my android simulator, it is totally ok.I have deleted node module and reinstalled.But the error is still there.I don't want to entirely delete my ios/build folder since I have manually added library dependencies in there and that third party libraries were working properly in my react native project.Can someone help me with this?
Error Message
Requiring unknown module "11".If you are sure the module is there, try
restarting Metro Bundler.You may also want to run yarn or npm install(
depending on your environment ).
package.json
{
"name": "AwwsomeProject",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.3.1",
"react-native": "0.55.4",
"react-native-navigation": "^1.1.473",
"react-native-vector-icons": "^4.6.0"
},
"devDependencies": {
"babel-jest": "23.2.0",
"babel-preset-react-native": "4.0.0",
"jest": "23.2.0",
"react-test-renderer": "16.3.1"
},
"jest": {
"preset": "react-native"
}
}
Restarting packager fixed my issue.
I fixed the issue with the instructions from the following page:
https://facebook.github.io/react-native/docs/troubleshooting#content
Basically it asks you to terminate the processes running on a specific port.
Run the following command to find the id for the process that is listening on port 8081:
$ sudo lsof -i :8081
Then run the following to terminate the process:
$ kill -9 <PID>
I just killed all node processes
killall node
🙌 and launched again
I had the same problem. Running npm install or yarn install should fix the issue.
I had the same problem while working with my react native app and expo. Same screen with 'Requiring Unknown Module 1".
This is how I fixed it:
I closed Expo
I closed the Metro bundler on my local host
I closed the packager on my terminal with Ctlr + C
I restarted with npm start
I relaunched the project on Expo.
It worked for me.
I had this issue on Android (React-Native-CLI).
Terminating the application and restarting metro server absolutely solved the issue.
yarn react-native start
Using yarn, I did the following (for Android emulation):
From root directory in your project:
cd android
./gradlew clean
cd ..
yarn start --reset-cache
yarn android
Looks like node and the application inside simulator hangs sometimes. I encountered this several times on macOS / iOS.
yarn install did not help.
restarting simulation with expo run:ios / yarn start / yarn ios did not help.
What helped was killall node and killall <your_mobile_app_name>.
npm run ios fixed for me after npm start

React Native (newer version): "Unable to resolve module"

I'm new to React-Native and use the Expo xde GUI. I had no problems up to the point, I wanted to use external modules at. I installed them using npm install module. Next I wanted to import them into my App.js file using import Module from 'module' But after starting the project I got the following error in the Expo Client App on the iOS Simulator:
Unable to resolve module react-renderif from /Users/my_name/Desktop/ExpoProjekte/test/App.js: Module does not exist in the module map or in these directories:
/Users/my_name/node-modules
This might be related to
https://github.com/facebook/react-native/issues/4968 To resolve try
the following:
1. Clear watchman watches: watchman watch-del-all.
2. Delete the node_modules folder: rm -rf node_modules && npm install.
3. Reset Metro Bundler cache: rm -rf $TMPDIR/react-* or npm start -- --reset-cache. 4. Remove haste cache: rm -rf $TMPDIR/haste-map-react-native-packager-*.
ABI25_0_0RCTFatal
37-[ABI25_0_0RCTCxxBridge handleError:]_block_invoke
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_main_queue_callback_4CF
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE
__CFRunLoopRun CFRunLoopRunSpecific GSEventRunModal UIApplicationMain main start 0x0
I tried all tipps mentioned in the error message, but nothing helped. I also tried out many workarounds described on the internet (e.g. in this forum), but this also didn't lead to success. The problem occurs with all modules that I tried to install and to import, e.g. react-renderif and native-base.
Do you have any ideas how to solve this problem? I know that the question was asked several times in this forum, but the answers didn't help me, maybe because they only worked for older versions.
Regards,
Paul
Desktop operating system: MacOS Sierra (10.12.6)
Expo version: 2.22.1
npm version: 4.6.1 and 5.6.0 (I tried out both)
My package.json:
{
"name": "my_name",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"native-base": "^2.3.10"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
Try
react-native upgrade
or, react-native-git-upgrade
Note: Use this only if u have no way out since .It will clear all the changes you did in ios and android folder rest will remain the same.

SAP Cloud Platform slow build process because of npm install

We use grunt to build our HTML5 Applications on the SAP Hana Cloud Platform. Unfortunately it is very very slow and takes hours sometimes it runs in the 6 minutes timeout to build a small App.
The main reason is that everytime the necessary node packages are installed and npm install runs which takes hours :(
Has anyone experiences with this problem?
After creating some incidents the SAP Cloud Developers Team improve the performance and tell me not to use tilde character in package.json - this leads to many dependencies and maybe a timeout during npm install.
So a package.json should look like this when you are working with SAP Web IDE Full-Stack:
{
"name": "grunt-build",
"version": "0.0.1",
"description": "Grunt build",
"private": true,
"devDependencies": {
"grunt-stripcomments": "0.7.2",
"grunt-remove-logging-calls": "0.1.2",
"grunt-postcss": "0.9.0",
"autoprefixer": "7.2.4",
"grunt-contrib-less": "1.4.1",
"grunt-contrib-cssmin": "2.2.1",
"#sap/grunt-sapui5-bestpractice-build": "1.3.33"
}
}

New react-native project can't run-ios: The following build commands failed: CompileC

I am just trying to spin up a new react-native app but no luck.
react-native init NewApp
cd NewApp
npm install
react-native run-ios
Then see the below error:
** BUILD FAILED **
The following build commands failed:
CompileC /Users/arc/Desktop/websites-dev/react-native/testing_rn/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/React.build/Objects-normal/x86_64/RCTProfile.o Profiler/RCTProfile.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/testing_rn.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/testing_rn.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Using:
npm 4.1.2
node v7.5.0
El Capitan 10.11.6
Xcode 8.2
package.json:
{
"name": "testing_rn",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "15.4.2",
"react-native": "0.42.3"
},
"devDependencies": {
"babel-jest": "19.0.0",
"babel-preset-react-native": "1.9.1",
"jest": "19.0.2",
"react-test-renderer": "15.4.2"
},
"jest": {
"preset": "react-native"
}
}
It seems like this may be related to the build via terminal but app may still work in xcode?
Print: Entry, ":CFBundleIdentifier", Does Not Exist have tried most solutions
github issue from 25 days ago:
https://github.com/facebook/react-native/issues/12737
Some related questions:
https://github.com/facebook/react-native/issues/7308
React-native run-ios commands fails
=========================================================
UPDATE:
For me, this seemed to have something to do with 0.42.0 and above. I can run a 0.41.2 project that I install with
react-native init --version 0.41.2 example412
cd example412
npm install
react-native run-ios
And boom. It works. But this gets errors:
react-native init example_latest
cd example_latest
npm install
react-native run-ios
then above errors are back. Same errors with init version at 0.42.0:
react-native init --version 0.42.0 example420
cd example420
npm install
react-native run-ios
For me, I guess I needed to update xcode. I thought I was on 8.3 but apparently not. I also needed to update osx to 10.12.4 prior to updating my xcode. Now I'm all good and running a react-native init app at 0.42.3

React-native 0.21 (android) remote debugger (Chrome) cannot connect

My remote debugging (Via Chrome with React-native dev tools 0.14.8) used to work fine.
I am not sure what exactly happened in between (I upgraded to react-native 0.21, did an update to android studio, updated Linux Mint 17.3 with apt-get update/ upgrade).
But now all I see is
"Please Wait
Connecting to Remote debugger" for about 5-8 seconds on my emulator, and then I get the error (see attached image):
"Unable to connect with remote debugger"
I have tried re-installing Chrome React-native extensions. Tried rebuilding my app. Did not help.
I am not exactly sure where the problem is. May be I just need to increase a value for connection timeout.. but there does not seem to be an option like that.
Below is also my package.json (it took a couple of days to go through the 0.20 to 0.21 upgrade, due to various dependency problems).
May be there is a new settings there that I am missing, that somebody could point out.
{
"name": "ftesting",
"version": "1.0.0",
"description": "ftesting desc",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node_modules/react-native/packager/packager.sh",
"android-setup-port": "adb reverse tcp:8081 tcp:8080",
"test": "eslint ./src/js.app/my.forms",
"start": "rnws start",
"clean:babelrc": "find ./node_modules -name react-packager -prune -o -name '.babelrc' -print | xargs rm -f",
"postinstall": "npm run clean:babelrc"
},
"repository": {
"type": "git",
"url": "xyz" },
"keywords": [
"ftesting"
],
"author": "ls",
"license": "MIT",
"engines": {
"node": ">=4",
"npm": ">=2 <4"
},
"devDependencies": {
"babel-eslint": "^6.0.0-beta.1",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-1": "^6.5.0",
"eslint": "~2.2.0",
"eslint-loader": "^1.1.1",
"eslint-plugin-react": "^4.2.0"
},
"dependencies": {
"react-native": "^0.21.0",
"#remobile/react-native-splashscreen": "^1.0.3",
"react-native-blur": "^0.7.10",
"react-native-htmlview": "^0.2.0",
"react-native-material-kit": "^0.3.0",
"react-native-material-design": "^0.3.3"
}
}
There's a github issue posted with this problem. You can follow there:
https://github.com/facebook/react-native/issues/6390
Maybe it's silly problem for someone else, if it helps, for me the problem solved when I connected the wifi (I had disconnected it :)
I realized it was a connectivity problem, when I've requested from the browser the url which react native is getting the index.bundle from (the one in config settings in device app) and found that it was reachable...
I'm using 0.25.0-rc
It is definitely working now.
Tested with 0.25.1
Look at the replies in the linked github issue.
Overall, I think the big problem was that once react-native team addressed the orginal issue that was introduced in 0.21, they changed the way you are supposed to build the application.
And if you did not change, the error was salient. So it was impossible to catch it during debug/build process.
Basically since Feb 2016, you are no longer supposed to pull react-native jar from maven repository. Instead, you need to point your gradle.build to the react-native jar from the npm-modules location
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$projectDir/../../node_modules/react-native/android"
}
}
}
and then
compile "com.facebook.react:react-native:+"
this combination of changes above, allowed me to link to the latest copy of the react-native jar, rather than pulling 0.20.1 from maven (and notice that 0.20.1 from maven had not been modified since feb 2016).
This is for apps created with react-native init or ejected from expo.
Start de app with:
react-native run-android
The emulator will show the red screen debugger connection error (that is why we are here in the first place).
With the emulator in focus press:
Ctrl+M
or from the shell issue:
adb shell input keyevent KEYCODE_MENU
The in app Developer Menu will appear:
Click in
Dev settings
Select the option:
Debug server host & port for device
And enter:
localhost:8081
Now we’ll make calls in port 8081 in the emulator go to the same port on the host machine.
From the shell do:
adb reverse tcp:8081 tcp:8081
Ready, just restart the app
react-native run-android