I am setting up IOS dev for React Native (0.61) app which has the working android version. What I did was to copy src of components and package.json file after react native environment is setup by following online post (installed xcode command line tool 10.2). But launching run-ios failed:
$ react-native run-ios
error Could not find "Podfile.lock" at /Users/mine/Documents/code/js/emps_fe6/ios/Podfile.lock. Did you run "pod install" in iOS directory?
error Could not find the following native modules: RNCAsyncStorage, RNDeviceInfo, RNGestureHandler, RNKeychain, BVLinearGradient, RNLocalize, RNReanimated, RNVectorIcons, react-native-video. Did you forget to run "pod install" ?
info Found Xcode project "emps_fe6.xcodeproj"
xcrun: error: unable to find utility "simctl", not a developer tool or in PATH
error Could not parse the simulator list output. Run CLI with --verbose flag for more details.
Error: Command failed: xcrun simctl list --json devices
xcrun: error: unable to find utility "simctl", not a developer tool or in PATH
at checkExecSyncError (child_process.js:629:11)
at Object.execFileSync (child_process.js:647:13)
at runOnSimulator (/Usersamine/Documents/code/js/emps_fe6/node_modules/#react-native-community/cli-platform-ios/build/commands/runIOS/index.js:130:54)
at Object.runIOS [as func] (/Users/mine/Documents/code/js/emps_fe6/node_modules/#react-native-community/cli-platform-ios/build/commands/runIOS/index.js:100:12)
at Command.handleAction (/Users/mine/Documents/code/js/emps_fe6/node_modules/#react-native-community/cli/build/index.js:164:23)
at Command.listener (/Users/mine/Documents/code/js/emps_fe6/node_modules/commander/index.js:315:8)
at Command.emit (events.js:198:13)
at Command.parseArgs (/Users/amine/Documents/code/js/emps_fe6/node_modules/commander/index.js:651:12)
at Command.parse (/Users/mine/Documents/code/js/emps_fe6/node_modules/commander/index.js:474:21)
at setupAndRun (/Users/mine/Documents/code/js/emps_fe6/node_modules/#react-native-community/cli/build/index.js:237:24)
Here is the output of react native info:
$ react-native info
info Fetching system and libraries information...
System:
OS: macOS High Sierra 10.13.6
CPU: (8) x64 Intel(R) Core(TM) i7-2675QM CPU # 2.20GHz
Memory: 194.93 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.17.0 - /usr/local/bin/node
Yarn: 1.19.1 - /usr/local/bin/yarn
npm: 6.11.3 - /usr/local/bin/npm
IDEs:
Xcode: /undefined - /usr/bin/xcodebuild
npmPackages:
react: 16.11.0 => 16.11.0
react-native: 0.61.2 => 0.61.2
npmGlobalPackages:
react-native-cli: 2.0.1
Here is the package.json:
"dependencies": {
"#react-native-community/async-storage": "^1.6.2",
"moment": "^2.24.0",
"react": "16.11.0",
"react-native": "0.61.2",
"react-native-cli": "^2.0.1",
"react-native-confirmation-code-field": "^4.1.0",
"react-native-device-info": "^4.0.1",
"react-native-elements": "^1.2.6",
"react-native-gesture-handler": "^1.4.1",
"react-native-gifted-chat": "^0.11.3",
"react-native-keychain": "^4.0.1",
"react-native-linear-gradient": "^2.5.6",
"react-native-localize": "^1.3.1",
"react-native-modal": "^11.4.0",
"react-native-modal-datetime-picker": "^7.6.0",
"react-native-reanimated": "^1.3.0",
"react-native-segmented-control-tab": "^3.4.1",
"react-native-vector-icons": "^6.6.0",
"react-native-video": "^5.0.2",
"react-navigation": "^4.0.10",
"react-navigation-stack": "^1.10.2",
"react-navigation-tabs": "^2.5.6",
"simctl": "^2.0.0",
"socket.io-client": "2.1.1",
"xcode": "^2.0.0"
},
In the error message, there mentioned quite a few modules which are missing. But those modules have been installed as it shows in the package.json. I am not sure about what the error message means. Also I installed the simctl but scrum simctl still can not find it. I am using VS Code as IDE.
UPDATE:
created an empty Podfile.lock under /ios, the error becomes when run-ios:
error Cannot read property 'SPEC CHECKSUMS' of undefined. Run CLI with --verbose flag for more details.
TypeError: Cannot read property 'SPEC CHECKSUMS' of undefined
at getDependenciesFromPodfileLock (/Users/mine/Documents/code/js/emps_fe6/node_modules/#react-native-community/cli-platform-ios/build/link-pods/getDependenciesFromPodfileLock.js:63:58)
at warnAboutPodInstall (/Users/mine/Documents/code/js/emps_fe6/node_modules/#react-native-community/cli-platform-ios/build/link/warnAboutPodInstall.js:43:67)
at Object.runIOS [as func] (/Users/mine/Documents/code/js/emps_fe6/node_modules/#react-native-community/cli-platform-ios/build/commands/runIOS/index.js:80:36)
at Command.handleAction (/Users/mine/Documents/code/js/emps_fe6/node_modules/#react-native-community/cli/build/index.js:164:23)
at Command.listener (/Users/mine/Documents/code/js/emps_fe6/node_modules/commander/index.js:315:8)
at Command.emit (events.js:198:13)
at Command.parseArgs (/Users/mine/Documents/code/js/emps_fe6/node_modules/commander/index.js:651:12)
at Command.parse (/Users/mine/Documents/code/js/emps_fe6/node_modules/commander/index.js:474:21)
at setupAndRun (/Users/mine/Documents/code/js/emps_fe6/node_modules/#react-native-community/cli/build/index.js:237:24)
at Object.run (/Users/mine/Documents/code/js/emps_fe6/node_modules/#react-native-community/cli/build/index.js:184:11)
First install the cocoapods
sudo gem install cocoapods
Then run the below command on root folder
cd ios && pod install && cd ../ && react-native run-ios
Step 1:
sudo gem install cocoapods
Step 2:
cd ios && pod install && cd ../ && react-native run-ios
If you still get error while installing pods continue the below steps.
Step 3: Put this in console ->
xcrun -k --sdk iphoneos --show-sdk-path
if the answer is
xcrun:_ error: SDK "iphoneos" cannot be located
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: unable to lookup item 'Path' in SDK 'iphoneos'
then put this:
sudo xcode-select --switch /Applications/Xcode.app
Then install pod again
I had the same issue and I solve the problem using bellow approach.
Navigate to iOS folder and then run bellow command:
pod update
pod update command will update all dependency and generate a "Podfile.lock" file.
I had a similar issue and resolved it by jumping into the ios folder and running:
pod update
Doing this directly in the ios folder resulted in the generation of Podsfile.lock
Changing out of ios into the main directory I was able to then launch the app on an IOS simulator using:
npx react-native run-ios
I have tried many solutions. But finally tried something logical. I don't know why i didn't tried first :)
pod install doesn't work.It changes nothing. The problem is "Podfile" is there but not "Podfile.lock". Thats the problem. When we try install again, it is doing nothing because Podfile is there.
Solution is removing "Podfile" then pod install again. Then you will see both files "Podfile" and "Podfile.lock". After many hours of struggling, this was the solution for me and i have tried many thing :) Good luck to you all.
For anybody with Mac M1 that nothing worked and still having the problem.
They actually say at the docs you need to run those commands
sudo arch -x86_64 gem install ffi
arch -x86_64 pod install
when it ends will tell
[!] Please close any current Xcode sessions and use `MyApp.xcworkspace` for this project from now on.
Pod installation complete! There are 55 dependencies from the Podfile and 46 total pods installed.
if you go and now run pod install you will notice the deference
This solution would work when you are trying to START a project, I don't know if it would help while you are in one and come across this issue.
Here is what I did:
install node.js (unless you already have it downloaded)
TO CHECK: go into terminal and type: node -v
install homeBrew (unless you already have it downloaded)
To download: go into terminal and type: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
remember to read what it says on the terminal to fully download it (there should be like two other commands you put in)
install watchman, on terminal type: brew install watchman
on terminal uninstall all your cocoapod stuff. Check how to with this link: https://superuser.com/questions/686317/how-to-fully-uninstall-the-cocoapods-from-the-mac-machine
open up VScode
type npx react-native init TestProject
choose the method to install Cocoapods through Homebrew
This worked for me.
Related
Issue Description
tns apple-login fails with sms verification
$ tns apple-login
✔ Apple ID … me#example.com
✔ Apple ID password … ************
✔ Please enter the 6 digit code … 955316
Request failed with status code 400
Reproduction
use tns apple-login command from macbook air.
Relevant log output (if applicable)
No response
Environment
$ npm i -D nativescript-envinfo
added 2 packages, and audited 454 packages in 2s
50 packages are looking for funding
run npm fund for details
2 moderate severity vulnerabilities
To address all issues (including breaking changes), run:
npm audit fix --force
Run npm audit for details.
➜ calmness-mobile git:(main) ✗
$ npx nativescript-envinfo
OS: macOS 12.6.3
CPU: (4) x64 Intel(R) Core(TM) i5-5350U CPU # 1.80GHz
Shell: /bin/zsh
node: 16.17.0
npm: 8.15.0
nativescript: 8.3.3
# android
java: Not Found
ndk: Not Found
apis: Not Found
build_tools: Not Found
system_images: Not Found
# ios
xcode: 13.4.1/13F100
cocoapods: 1.11.3
python: 3.10.6
python3: 3.10.6
ruby: 2.7.6
platforms:
- DriverKit 21.4
- iOS 15.5
- macOS 12.3
- tvOS 15.4
- watchOS 8.5
Dependencies
"dependencies": {
"#nativescript/core": "~8.1.3",
"#nativescript/theme": "^3.0.2",
"#triniwiz/nativescript-couchbase": "^1.3.1",
"#triniwiz/nativescript-image-cache-it": "^7.0.21",
"#triniwiz/nativescript-toasty": "^4.1.3",
"nativescript-audio": "^6.2.6",
"nativescript-platform-free": "^1.3.2",
"svelte-gestures": "^1.4.1",
"svelte-native": "~1.0.5"
},
"devDependencies": {
"#nativescript/android": "^8.4.0",
"#nativescript/ios": "^8.3.3",
"#nativescript/preview-cli": "^1.0.0-beta.18",
"#nativescript/types": "^8.3.0",
"#nativescript/webpack": "^5.0.6",
"nativescript-envinfo": "^1.0.9",
"svelte": "~3.44.0",
"svelte-loader": "^3.1.2",
"svelte-native-preprocessor": "^1.0.0",
"svelte-preprocess": "^4.7.0",
"typescript": "^4.5.5"
}
https://v7.docs.nativescript.org/tooling/docs-cli/publishing/appstore-upload.html
I spent like 3-4 days trying to figure this out and I cant a solution to it. i googled around and can't find answer.
What happened was everytime I create a new file I get this error.
I used react-native init ProjectName. npm install. cd ios. pod install. cd ..
then react-native run-ios and this is what I get.
asdf#Asdf-MacBook-Pro ProjectName % react-native run-ios
info Found Xcode workspace "ProjectName.xcworkspace"
info Building (using "xcodebuild -workspace ProjectName.xcworkspace -configuration Debug -scheme ProjectName -destination id=3A1A98EB-1D97-4DC2-967F-565F3971D608")
(node:16102) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
node --trace-warnings ...
node:internal/modules/cjs/loader:959
throw err;
^
Error: Cannot find module '/Users/asdf/Desktop/starter/ProjectName/...'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
at Function.Module._load (node:internal/modules/cjs/loader:804:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Things I already did
I deleted node_modules and package-lock.json and npm install again.
npm install -g react-native-cli && npm install -g react-native before npm install
upgrade node, nvm, npm
downgrade node, nvm, npm
current version
node v16.17.0
nvm 0.39.1
npm 7.24.2
first apply what you see in the picture via xcode ,you need try this and try yarn ios, and u can try in terminal on your project/ios. arch -arm64 pod install
I am facing issue in react-native project. It's working fine in android but build failed in iOS version. I have already tried all possible solution, but didn't get any solution.
The main problem is PhaseScriptExecution.
Xcode version - 12.4
Mac OS version - 11.3 (Big Sur)
npm version - 7.10.0
react-native version - 0.64.0
react version - 17.0.1
For mode detail, i am attaching the screenshot.
/Users/mmdev1/Library/Developer/Xcode/DerivedData/PRJ22-edpcityjusyktkdaxtnvzawndbxa/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FBReactNativeSpec.build/Script-99DF087F7D2E061B36AA638AA7C0AD26.sh: line 4: 16519 Segmentation fault: 11 bash -l -c 'SRCS_DIR=/Users/mmdev1/Documents/RN/PRJ22/node_modules/react-native/scripts/../Libraries CODEGEN_MODULES_OUTPUT_DIR=/Users/mmdev1/Documents/RN/PRJ22/node_modules/react-native/scripts/../React/FBReactNativeSpec/FBReactNativeSpec CODEGEN_MODULES_LIBRARY_NAME=FBReactNativeSpec /Users/mmdev1/Documents/RN/PRJ22/node_modules/react-native/scripts/generate-specs.sh' 2>&1
I was getting the same failure, and I have not been able to pinpoint exactly why this works, but in my package.json I changed
"scripts": {
"ios": "react-native run-ios",
}
to
"scripts": {
"ios": "unset PREFIX && react-native run-ios",
}
As I was seeing some issues regarding the PREFIX env variable when using Node Versioning Manager (nvm).
When I run react-native run-ios build succeeds and created build folder under ios. But after build, when installation starts, get the below error. The project runs successfully when I run it through xcode. What I observed is that path beginning 'DerivedData' is wrong. Instead it should be 'build'. When I rename my 'build' folder to 'DerivedData' and re-run 'react-native run-ios' the whole process completes successfully but of course with the previous build.
How can I change the 'DerivedData' to 'build'?
This error occurred immediately after I upgraded from 0.59.9 to 0.60.0.
Error:
info Installing "DerivedData/Build/Products/Debug-iphonesimulator/mobileappname.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
error Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier DerivedData/Build/Products/Debug-iphonesimulator/mobileappname.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
. Run CLI with --verbose flag for more details.
Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier DerivedData/Build/Products/Debug-iphonesimulator/mobileappname.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
at checkExecSyncError (child_process.js:616:11)
at Object.execFileSync (child_process.js:634:13)
at runOnSimulator (/Users/armaneker/WebstormProjects/mobileappname/node_modules/#react-native-community/cli-platform-ios/build/commands/runIOS/index.js:189:45)
at process._tickCallback (internal/process/next_tick.js:68:7)
React Native version:
System:
OS: macOS 10.15
Binaries:
Node: 10.15.3 - /usr/local/bin/node
npm: 6.13.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.0, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
Xcode: 11.0/11A420a - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.0 => 0.60.0
npmGlobalPackages:
create-react-native-app: 1.0.0
react-native-cli: 2.0.1
react-native-git-upgrade: 0.2.7
Steps To Reproduce
used rn-diff-purge to upgrade from 0.59.9 to 0.60.0
android worked correctly
react-native run-ios build succeeded but installation of
app failed
The solution is not obvious, react-native-cli is trying to guess what xcode build configuration is currently setup on your computer which is what is happening on the function getBuildPath()
function getBuildPath(configuration, appName, isDevice, scheme) {
let device;
if (isDevice) {
device = 'iphoneos';
} else if (appName.toLowerCase().includes('tvos')) {
device = 'appletvsimulator';
} else {
device = 'iphonesimulator';
}
let buildPath = `build/${scheme}/Build/Products/${configuration}-${device}/${appName}.app`; // Check wether app file exist, sometimes `-derivedDataPath` option of `xcodebuild` not works as expected.
if (!_fs().default.existsSync(_path().default.join(buildPath))) {
return `DerivedData/Build/Products/${configuration}-${device}/${appName}.app`;
}
return buildPath;
}
The trick is not to patch this file, but to first setup your xcode configuration correctly Xcode > Preferences > Locations (see picture)
and Xcode > Preferences > Locations > Advanced
Once this is done, you have to cleanup your build folder, otherwise, react-native-cli will still assume that xcode is not behaving as expected, which will keep on producing the same error.
cd ios && rm -rf build
you can now execute npx react-native run-ios and everything should be fine again.
It took me quite some time to figure this out, I think that react-native-cli should output more details on what is going on under the hood for people not to be blocked.
Problem solved. I had to edit a file inside #react-native-community.
If anyone else has the same problem solution is below.
File location:
-> file:
-> node_modules
-> #react-native-community
-> cli-platform-ios
-> build
-> commands
-> runIOS
-> index.js line 314
Change:DerivedData/Build/Products/${configuration}-${device}/${appName}.app
To:build/Build/Products/${configuration}-${device}/${appName}.app
Cheers.
I am following the ReactNative tutorial for 0.58. I do everything it says to do and I am crashing after running react-native run-ios. I have seen this extremely similar SO question from 2016.
I attempted react-native upgrade and it recommended doing react-native-git-upgrade.This did nothing. Same problem.
The bit on running ./configure in the question above after cd-ing into glog did nothing. There was no configure script there. In the path NewStupidProject/node_modules/react-native/scripts there is a script called ios-configure-glog.sh. I run bash ios-configure-glog.sh and it says ios-configure-glog.sh: line 31: ./configure: No such file or directory.
I have also attempted setting Xcode to use the legacy build system. This did not fix the issue. I am restarting my laptop now to see if that makes any of these changes take effect. No luck. At the top it says:
Found Xcode project NewStupidProject.xcodeproj Building using
"xcodebuild -project NewStupidProject.xcodeproj -configuration Debug
-scheme NewStupidProject -destination id=854019D1-8EE7-4D13-87E1-385E6CAC21BE -derivedDataPath build" User
defaults from command line:
IDEDerivedDataPathOverride = /Users/me/NewStupidProject/ios/build
Prepare build
note: Using legacy build system
=== BUILD TARGET double-conversion OF PROJECT React WITH CONFIGURATION Debug ===
When I go into the home directory and run react-native --version the output is:
[NewStupidProject](master)$ react-native --version
react-native-cli: 2.0.1
react-native: 0.58.4
[NewStupidProject](master)$
My output after crashing is:
** BUILD FAILED **
The following build commands failed:
PhaseScriptExecution Install\ Third\ Party /Users/me/native_react_apps/NewStupidProject/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/Script-190EE32F1E6A43DE00A8543A.sh
(1 failure)
Installing
build/Build/Products/Debug-iphonesimulator/NewStupidProject.app An
error was encountered processing the command
(domain=NSPOSIXErrorDomain, code=22): Failed to install the requested
application The bundle identifier of the application could not be
determined. Ensure that the application's Info.plist contains a value
for CFBundleIdentifier. Print: Entry, ":CFBundleIdentifier", Does Not
Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier
build/Build/Products/Debug-iphonesimulator/NewStupidProject.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Error: Command failed: /usr/libexec/PlistBuddy -c
Print:CFBundleIdentifier
build/Build/Products/Debug-iphonesimulator/NewStupidProject.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
at checkExecSyncError (child_process.js:637:11)
at Object.execFileSync (child_process.js:655:13)
at Promise.then (/Users/me/native_react_apps/NewStupidProject/node_modules/react-native/local-cli/runIOS/runIOS.js:208:5)
How is it possible for the setup process to be this fraught with errors and this difficult?
WHY is this error message not in the Troubleshooting ReactNative setup?
HOW do I fix this? Is it possible to avoid this altogether in the future?
Other versioning info:
XCode: 10.1
Command Line Tools: 10.1
yarn: 0.27.5
watchman: 4.9.0
homebrew: 2.0.1
npm: 6.8.0
node: v11.9.0
macOS: 10.13.6
UPDATE:
I am trying to implement the solution in this issue in GitHub and I'm getting:
dyld: Library not loaded:
/usr/local/opt/readline/lib/libreadline.7.dylib Referenced from:
/usr/local/bin/awk Reason: image not found
./ios-install-third-party.sh: line 20: 24497 Broken pipe: 13
shasum -p "$cachedir/$file"
24498 Abort trap: 6 | awk -v hash="$hash" '{exit $1 != hash}' Incorrect hash: 61067502c5f9769d111ea1ee3f74e6ddf0a5f9cc
?/Users/me/.rncache/glog-0.3.5.tar.gz
UPDATE No. 2 I am trying to run the watchman watch-del-all command as recommended here to clear the cache for RN > 0.50 and the whole thing is hanging.
I tried modify the build system and it worked for me.
Detail:
Open your project workspace file in Xcode, and
File -> Workspace Settings -> Build system -> Legacy Build system