Detox build is failing by throwing YogaKit.modulemap' fatal error not found - react-native

Detox build is failing by throwing YogaKit.modulemap' fatal error not found
Xcode Version:- 11.3
"react": "16.11.0",
"react-native": "0.62.2"
"detox": "13.3.0", tried latest 16 version as well
But build got succeeded with the below configuration
"dependencies": {
"react": "^16.3.0-alpha.1",
"react-native": "0.59.9"
},
"devDependencies": {
"babel-jest": "22.4.1",
"babel-preset-react-native": "4.0.0",
"detox": "13.3.0",
"jest": "22.4.2",
"mocha": "^5.0.4",
"react-test-renderer": "^16.3.0-alpha.1"
** BUILD SUCCEEDED **
I think latest version of react-native is not compatible with the detox. I tried to get resolve for Yogakit, but ended with no luck.
Please let me know if anything is required. I would be thankful if someone shared the working config with the latest react-native.
`fatal error: module map file ....../ios/build/Build/Products/Debug-iphonesimulator/YogaKit/YogaKit.modulemap'
not found
1 error generated.
20 errors generated.
fatal error: module map file '...../ios/build/Build/Products/Debug-iphonesimulator/YogaKit/YogaKit.modulemap'
not found
1 error generated.
22 errors generated.
** BUILD FAILED **
The following build commands failed:
CompileC /....../ios/build/Build/Intermediates.noindex/King.build/Debug-iphonesimulator/King.build/Objects-normal/x86_64/AppDelegate.o /....../ios/King/AppDelegate.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
detox[29631] ERROR: [cli.js] Error: Command failed: xcodebuild -project ios/King.xcodeproj -scheme King -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build`

take a look at this config in package.json
"detox": {
"configurations": {
"ios.sim.debug": {
"binaryPath": "ios/build/Build/Products/Debug-iphonesimulator/example.app",
"build": "xcodebuild -project ios/example.xcodeproj -scheme example -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build",
"type": "ios.simulator",
"device": {
"type": "iPhone 11 Pro"
}
}
}
}
and take a look at that
For React Native 0.60 or above, or any other iOS apps in a workspace (eg: CocoaPods) use -workspace ios/example.xcworkspace instead of -project.

This is how I got it working:
Open xcworkspace file
Click on this :
http://files.simformsolutions.com.s3.amazonaws.com/simformscreen/ReactN.xcworkspace_2020-09-17_12-48-42.png
You will see such available options for your project/app as update
project settings to recommended :
http://files.simformsolutions.com.s3.amazonaws.com/simformscreen/ReactN.xcworkspace_2020-09-17_12-49-43.png
Click on the warnings and update the project to recommended settings, for all warnings.
On Convert to swift 5 available, if you click it, it will specifically show you the YogaKit module, click convert.
It will take time and voila!!
The build should succeed this time.

Xcode Menu -> File -> Save as Workspace -> (untitled name)
and then open that workspace file in the Xcode,
it will work
go to ios folder
open terminal
pod update
and then
https://www.youtube.com/watch?v=U30qHiEQWU8

I'm not sure what this Detox thing is so hopefully this isn't off topic
I came across this question by researching a missing YogaKit.modulemap not found kind of error (sorry I don't have the exact error) which I got after doing a pod install.
I fixed it by opening [project].xcworkspace then at the top Product > Clean Build Folder
OR
shift + command + k
Make sure Xcode has finished cleaning the build before trying to run the project again.

On the Podfile target post install ...
post_install do |installer|
flipper_post_install(installer)
installer.pods_project.targets.each do |target|
if target.name == 'YogaKit'
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '4.1'
end
end
end
end

Related

Fails to build project on another local machine from repository - Failed to install the app. Make sure you have the Android development environment

So I have existing react-native project and it works and builds fine ok on one local machine.
I pushed the project to repository, but it fails to build on another machine.
So I cloned the project from repository on another machine:
did npm-install
then I tried npx react-native start but it was missing 4 choices with "open Android app", instead it only shows two (without ios and android) so i tried npx react-native run-android instead but it fails with
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.
> Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
> Could not find com.facebook.react:react-android:.
Required by:
project :app
> Could not find com.facebook.react:hermes-android:.
Required by:
project :app
If I delete node_modules (it's ignored by Git) folder and copy node_modules from the first local machine then it works fine and npx react-native start detects ios and android apps can compiles them fine.
Content of perk_sample.json:
{
"name": "nameofapp",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"prop-types": "^15.8.1",
"react": "18.1.0",
"react-native": "0.70.2"
},
"devDependencies": {
"#babel/core": "^7.12.9",
"#babel/runtime": "^7.19.0",
"#react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.6.3",
"eslint": "^7.32.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "0.72.3",
"react-test-renderer": "18.1.0"
},
"jest": {
"preset": "react-native"
}
}
please ask me to add any other info if needed
I upgraded RN with npx react-native upgrade based on info from https://stackoverflow.com/a/74436820/7767664
Now it's
"react": "18.2.0",
"react-native": "0.71.2"
Now npx react-native start works fine now and I can see 4 choices and it builds as well (though not from the first try after all manipulations, re-running helped, but then again tried clean build and works from the first try)
Glad I'm a native dev and it's just a temporary project :)
Also had a problem that I was excluding gradle-wrapper.jar (was added to gitignore) and react-native could not download it itself with gradle (though Android Studio doesn't need this file on the repository, it can download it itself with gradle based on url at gradle-wrapper.properties):
info Installing the app...
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
Caused by: java.lang.ClassNotFoundException: org.gradle.wrapper.GradleWrapperMain

Tauri compilation error: STATUS_ACCESS_VIOLATION

I'm trying to use create-tauri-app to set up Tauri (for the first time) on my computer. I initialized it with npm create tauri-app, followed all the prompts and successfully created a project. After moving into the generated directory (I have not modified anything) and running npm i, I attempt to run npm run tauri dev, as instructed from the prompts by the app generator. Vite started successfully, and after a painfully long compilation of a bunch of cargo packages, I suddenly see this message in the terminal:
error: could not compile `tauri`
Caused by:
process didn't exit successfully: `rustc --crate-name tauri --edition=2021 C:\Users\[...]\tauri-1.0.5\src\lib.rs [... redacted because way too long]`
(exit code: 0xc0000005, STATUS_ACCESS_VIOLATION)
(...and the program crashes with lots of npm junk)
Note: this error was produced by Tauri or some third-party package. I have no control over the code from which the error originates.
I've double-checked everything and spent hours retrying, googling, restarting my computer, and other junk all to no avail. I understand STATUS_ACCESS_VIOLATION has something to do with memory being messed up (seems also to be an error code common in Chromium, so I suspect the culprit is webview2), but I have no idea how to pinpoint the issue.
If helpful, here's my system details as provided by running npx tauri info:
Environment
› OS: Windows 10.0.18363 X64
› Webview2: 104.0.1293.47
› MSVC:
- Visual Studio Build Tools 2017
› Node.js: 14.16.1
› npm: 6.14.12
› pnpm: 6.11.0
› yarn: 1.22.15
› rustup: 1.25.1
› rustc: 1.62.1
› cargo: 1.62.1
› Rust toolchain: stable-x86_64-pc-windows-gnu
Packages
› #tauri-apps/cli [NPM]: 1.0.5
› #tauri-apps/api [NPM]: 1.0.2
› tauri [RUST]: 1.0.5,
› tauri-build [RUST]: 1.0.4,
› tao [RUST]: 0.12.2,
› wry [RUST]: 0.19.0,
App
› build-type: bundle
› CSP: unset
› distDir: ../dist
› devPath: http://localhost:5173/
› framework: Vue.js
App directory structure
├─ .vscode
├─ node_modules
├─ public
├─ src
└─ src-tauri
And here's the package.json for anyone who's interested:
{
"name": "tauri-app",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"tauri": "tauri"
},
"dependencies": {
"#tauri-apps/api": "^1.0.2",
"vue": "^3.2.37"
},
"devDependencies": {
"#tauri-apps/cli": "^1.0.5",
"#vitejs/plugin-vue": "^3.0.0",
"vite": "^3.0.0"
}
}
As you can see, I've installed all the required items and nothing seems out of place. Has anyone faced this issue before or have any ideas on how to fix this? I'm desperate to find a solution.
Update
After following a suggestion from a comment that I should be using the msvc Rust toolchain instead of the gnu, the original error is no longer present, but I have a completely different mysterious error about my OS not being supported (Os { code: 216, kind: Uncategorized, message: "This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher." }), so this question is no longer awaiting answers (unless you know how to fix the most recent said issue, please comment).
You need Visual Studio Build Tools version 2019 or greater. I was also getting this error with build tools 2017 and installing 2022 resolved it.
Step one of the getting started guide for windows says to install 2022. I believe any version after 2019 will work but I would recommend 2022 as that's what the guide suggests.
Visual Studio Build Tools 2022
you need to delete the target directory and restart the project so that it'clean and no error remains.

npm start command gives error in react native

I have been using /programming react native app since last 2 months.
Always it used to work fine , I could code and run the simulator on my iphone . The environment details are as follows:
EXPO --version 3.1.2 , npm -v 6.9.0, node -v12.4.0
Suddenly, yesterday when I started the project by command 'expo start' it did not start, got a message expo is not installed. Hence I installed expo cli.
Now I typed the command 'expo start', however it gives error
It opens the Metro builder but stops with error
I am unable to start the project and continue coding the app
I tried following troubleshooting :
removed 'node_modules' folder , re-installed 'npm install'
however the same issue persists.
Expected:
The project should start , I should be able to run the simulator in phone
Actual:
The project did not start with 'expo start'
Microsoft Windows [Version 10.0.17134.1006]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\Users\Jituni>cd C:\Users\Jituni\bholmentorworld
C:\Users\Jituni\bholmentorworld>expo start
Starting project at C:\Users\Jituni\bholmentorworld
Expo DevTools is running at http://localhost:19002
Opening DevTools in the browser... (press shift-d to disable)
Error: Can't find react-native in package.json dependencies
Error: React Native is not installed. Please run `npm install` in your project directory.
Couldn't start project. Please fix the errors and restart the project.
Set EXPO_DEBUG=true in your env to view the stack trace.
this is the dependencies.
{
"dependencies": {
"eslint": "^6.2.1",
"expo": "^33.0.0",
"firebase": "^6.4.0",
"react": "16.8.3",
"react-dom": "^16.8.6",
"react-native-gesture-handler": "^1.2.2",
"react-native-reanimated": "^1.0.1",
"react-native-web": "^0.11.4",
"react-navigation": "^3.11.1"
}
}
you hadn't installed the react-native in your dependencies.
SOLUTION
you should make the new project with expo-cli.
FIRST, run this command -> expo init projectname
at this step, select the blank project selection.
then you can see the generated project.
SECOND, merge the dependencies. and then run npm install or yarn install.
LAST, run react-native project with npm start or yarn start.

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