Running RNTester - xcode

I am getting into React Native. I want to try running RNTester to check out the components they have. I had no issue runnning my other react project.
I tried the commands:
git clone https://github.com/facebook/react-native.git
cd react-native
npm install
and also run the project with open RNTester/RNTester.xcodeproj
The errors I got:
error message
my Xcode version: 9.0(9C40b)
clang version: Apple LLVM version 9.0.0 (clang-900.0.39.2)

Instead of running with RNTester.xcodeproj
I got around with CocoaPods.
run pod install in the RNTester folder
run the .xcworkspace file generated from the command

Related

about 'zsh react-native command not found' AFTER SETTING PATH

Some time ago, I had the command not found error when running expo, so I set path at ~/.bash_profile and so, after running source ~/.bash_profile, now I can call expo without problems.
Today, I tried running react-native link and the following error appeared:
zsh: react-native command not found
What else could I be doing wrong?
Maybe you don't have react native cli installed globally, which is good as it's not needed.
Check in the project directory if react-native is installed
so ./node_modules/react-native/ should exist and has something inside.
If so, you don't need to run react-native directly; try running through npx react-native or npm script.
If not, make sure you have react-native in package.json dependencies section, and run npm install to pull the react-native library folder.

How to update nativescript cli

Nativescript 5 is out and I am trying to update the tns version. Currently it tns --version shows as 4.3.2.
I followed all the steps in https://docs.nativescript.org/releases/upgrade-instructions but it still gives me the version as 4.3.2.
How can I upgrade nativescript-cli so that tns --version shows me the latest version.
I did following to reflect the update Nativescript cli. You should only follow this when npm install -g nativescript#latest doesn't reflect update the cli. You can check that using tns --version before and after.
Uninstall current nativescript cli using npm uninstall -g nativescript
Delete the existing tns command manuall if it still exist on your machine.
Install the latest Nativescript cli using npm install -g nativescript#latest
tns --version should now show the latest version.
How I did update tns:
run cmd as administrator (you using windows as i read above in one of comments)
(optional) run npm view nativescript version to check latest aveilable on npm
run tns install -g nativescript
restart cmd
run tns --version - hopefully you will see 5.0.0
hope this helps.
Btw, you might need to run some additional commands for your projects if you already added platforms
tns platform remove {platform}
tns platform add {platform}, where {platform} is android or ios
...also, you might run tns doctor after upgrading as I noticed it broke my other components like choco.

NativeScript Sidekick won't run since CLI 3.2.1 update doesn't work

I opened NativeScript Sidekick on my Mac and it updated to the latest version 0.2.5.
It shows a dialog stating I need to update NativeScript CLI to 3.2.1 and the only option is to quit.
I went to Terminal and tried tns update but it won't update to 3.2.1 saying the platforms for 3.2.1 are not available. (I posted to the NativeScript forums and was told that is correct -- the platforms are at 3.2.0 while only the CLI is updated to 3.2.1.)
I also tried tns update 3.2.1 which simply says 3.2.1 platforms are not available.
tns doctor says 3.2.1 update is available.
NativeScript CLI version is 3.2.0
npm version is 5.4.1
node version is 6.11.3
I've tried creating a new project and it gives me the same issues.
How can I update to NativeScript CLI 3.2.1 so that I can run NativeScript Sidekick?
Solved over on https://discourse.nativescript.org/t/tns-update-3-2-1-not-working/2766/5
the command tns update will update your project, not CLI. If you want to update CLI do:
npm uninstall -g nativescript
npm clear cache
npm install -g nativescript
The command ths update is currently not working, we’ll investigate.
If you are using nvm to manage your NodeJS versions you can try to set the default version to the one that has installed NativeScript CLI. For example if you have NativeScript CLI on NodeJS version 8.9.2, execute:
nvm alias default 8.9.2
To check the packages installed on your active NodeJS version, execute:
npm list -g --depth 0

React-Native app with cocoapods

I have a react-native application which comes with .xcodeproj file for ios.
I upgraded the project to use cocoapods which added .xcworkspace and updated .xcodeproj file.
Now anytime i try to upgrade react-native to latest version upgrading .xcodeproj is a nightmare.
Just curious if you are facing similar issues then what is the best practice you found to deal with upgrades?
Yes I had a lot of pain following the recommended ways. Finally, here's what I found to be a pain free way to do the upgrade:
$ rm package-lock.json (or npm-shrinkwrap.json, whichever you have)
Update package.json with the new version of React and React-Native dependencies
$ npm install
$ npm-shrinkwrap (if you had an npm-shrinkwrap.json)
$ rm Podfile.lock
$ pod install
Open workspace (*.xcworkspace) and build.
(This has worked fine when upgrading from 0.46.0 to 0.50.3 version for me)

Unable to build Xcode project on circleCi

I'm using cocoapods v1.0.1. My build is successful in Xcode 7.2.1 but when I push the changes to git it fails on circleci.com.
error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.
I have tried every possible ways using this link and similar links but no success at all.
Already tried this link: Error:"The sandbox is not in sync with the Podfile.lock..." after installing RestKit with cocoapods
Try to add the following into your circle.yml file:
dependencies:
override:
- pod install
https://discuss.circleci.com/t/the-sandbox-is-not-in-sync-with-the-podfile-lock/5537

Resources