Expo android build into script - react-native

Currently, I'm using expo-cli#2.6.13.
I want to create a script that in every PR merged into the devel branch do a build for Android into my expo account.
To do that I'm using a bitbucket pipeline with just these commands:
expo login -u $EXPO_USER -p $EXPO_PASSWORD
expo build:android --non-interactive
However, the pipeline is never finishing... It's displaying this message:
Success. You are now logged in as myUsername.
And then nothing more... It looks like the second command line is not executed.
I tried to add the --non-interactive also in the first line, but neither works, it's happening just the same.
Does anybody have an idea about how to do it correctly?
Thank you 😊

No idea why... But updating the bitbucket pipeline node version from 8.10 to 10.10 fix this problem...

Related

Expo won't start the simulator / emulator

I always used to start my Expo project by typing in the terminal expo start and then i (for iOS simulator). The day after iOS 16 got released, Expo started to behave differently. After running expo start it gave me a warning: This command is being executed with the global Expo CLI. Learn more: https://blog.expo.dev/the-new-expo-cli-f4250d8e3421
To use the local CLI instead (recommended in SDK 46 and higher), run:
› npx expo start and after pressing i it threw the following error:
Error running xcrun simctl help: You may need to run sudo xcode-select -s /Applications/Xcode.app and try again.
XDLError: You may need to run sudo xcode-select -s /Applications/Xcode.app and try again.
Unable to verify Xcode and Simulator installation. After this I killed the terminal and in a new one I decided to follow the command it gave me in the warning (after running expo start). I ran npx expo start and then i and it threw me a new error which was:
Unable to run simctl:
Error: xcrun exited with non-zero code: 72
CommandError: xcrun is not configured correctly. Ensure sudo xcode-select --reset works before running this command again., but this time it didn't gave me a warning before pressing i. I also tried to run the commands shown in the errors and re-run the app, but still the same errors were thrown. I updated my OS, XCode and also deleted and cloned the project again so i could re-install dependencies just in case something was wrong with them.
I have attached the GitHub repo link of one of my projects so you can test it as well. It's not just this project, it's all of the projects I use Expo, even the new ones won't start.
If anyone has any idea how to fix this and why this happens, I would really appreciate it :)
Uninstalled and re-installed Expo globally. Updated the simulator to iOS 16 and opened the simulator before running expo start. It works as it did before.

AppCenter Yarn 1.19 error Incorrect integrity when fetching from the cache

I have a React Native app hosted on Microsoft App center. The builds (both iOS and android) are failing because of yarn 1.19 (error Incorrect integrity when fetching from the cache)
I tried to remove the package-lock.json but it didn't help.
I would like to downgrade yarn or execute the cache clean command but don't know where to execute it.
I have installed the appcenter cli version 2.2.1 and successfully connected to it.
Where could I execute yarn cache clean for example?
I've read I could also create a script but I have no idea where to place it and how it should look like. Should it be both in the ios and android directory? Or in the root? Thank you
I actually noticed that I had a yarn.lock back from the initial commit, even though we are using npm in the team.
In the build logs, there is this line:
/bin/sh -c if [ -f yarn.lock ]; then { yarn install && yarn list --depth=0; } else npm install; fi
So I deleted the yarn.lock file and now it builds successfully using npm!
Not sure whether you build your React app with Azure Devops pipeline. If yes, you can use Command line task to achieve the things you want to do.
If the agent you used is hosted agent during the build, since each build will use a completely new VM, you need to install the AppCenter cli once per build.
Use follow command to install the AppCenter cli:
sudo npm install -g appcenter-cli
Then logging in it:
appcenter login --token {Token}
Here, you need first generate the token with this doc described: Go and login to https://appcenter.ms/ -> Click Self Avatar -> Choose Account Settings -> Click on API Tokens -> Click New API token then select the corresponding the scope for this token.
Copy and use it in this pipeline task. Note: Recommend you store
this token with secret variable for security.
Now, you can execute the clean command: yarn cache clean.
Where to place it and how it should look like?
According to your description, you need place this command line task into the first step, then it could clean the Yarn cache firstly.
Also, because of the image configuration that the hosted agent is using, its installed node.js version is 6.7.0, this does not match the runtime environment for AppCenter cli. You need also run Node.js tool installer task to install node.js v10.0.0.
All of them should look like this:
Should it be both in the ios and android directory?
As I mentioned previously, for Hosted agent, each build will use a completely new VM. So yes, you must execute these two steps firstly in every build.
If what you used is your private agent, since you have installed the AppCenter cli locally, the agent will automatically call the local configuration when running the command line task. At this time, you just need to skip the install command in the command task:
We fixed it by adding a "yarn cache clean" in appcenter-post-clone.sh, you can add this shell script in root of project.
See this docs for details.

"--watch is not supported without git/hg" with cygwin jest and git

I would really appreciate help with this.
I have cygwin installed and set up to use the PATH from windows. This has been working great for a ton of node development, but I've recently run into an issue where when I run
yarn jest --watch
I get the following error:
--watch is not supported without git/hg, please use --watchAll
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
I have installed git and node in windows.
I have found a workaround of using the Command Prompt for running the tests, but would really like to be in one environment.
--watch works only for git repositories.
if you still have issue it is yarn issue npm gives the same error too. delete your node_modules folder, update yarn or npm to the latest version, then reinstall all the packages again.
After some consideration, I thought my workaround could be a valid answer to this question. Although, I would still like to get this working properly in Cygwin.
If you have node and git installed in windows then you can go into the Command Prompt and run yarn test --watch or npm run test -- --watch to accomplish the same thing.
I know it's been a long time. But i was facing the same issue and what resolved it for me was, to change the default terminal of whatever editor you're using to GIT command line. I was using VS Code and changing the terminal to GIT worked like a charm.
Make sure you're running it in a Git repo (initialised with git init). Otherwise it doesn't know how to get only the changed files.
If you don't want to run tests only on changed files, you can use --watchAll, which runs all the tests.
I also encountered this problem, the reason is that I use the mv command to move the project folder, however the command was not removed .git has points such as the beginning of the file
npm run test -- watchAll
Please use watchAll to serve it in a continue way. It will track your changes and re-run the test automatically.
git init
solves the problem, that way it knows the changed files

Can't create react native app. Input is required, but expo is in non-interactive mode

I just started learning react native and I'm stuck at the beginning.
I installed react native with npm install -g create-react-native-app, but when i try to create app with create-react-native-app it just says:
Input is required, but expo is in non-interactive mode. Required
input:
> Choose a template:
are you using git bash? try to use normal cmd to create the project
you can't run the CLI in 'interactive mode' if you are using Git Bash, instead, you can use cmd, but if you insist on using Git Bash then you need to pass 2 arguments: name and template . so instead of
expo init <project-name>
you'd actually pass:
expo init <project-name> --template <one-of-the-predefined-templates> --name <AppName>
for example, expo init facebook-clone --template blank --name FacebookClone
the template argument defines how much boilerplate the project is initiated with the name argument defines the app name (as shown in the home screen or even in Expo itself)
Use cmd or another TTY command-line tool. Don't use git bash - it is not TTY.
expo --help
Usage: expo [options] [command]
Options:
-V, --version output the version number
-o, --output [format] Output format. pretty (default), raw
--non-interactive Fail, if an interactive prompt would be required to continue. Enabled by default if stdin is not a TTY.
In that case you can all commands mentioned above:
expo init my-new-project
or do expo login first
you can use the following command.
expo init youappfolder --template blank
Hope this helps.
Use this command if you are using gitbash instead of cmd or powershell:
expo init my-app --template blank --name myApp
By default expo uses yarn to install packages.
If you want to use npm instead, use the following command:
expo init my-app --template blank --name myApp --npm
you must determine what the template you neeed
so you can run this
expo init projectName --template blank
or
expo init projectName --template tabs
Use cmd or another TTY command-line tool. Don't use git bash - it is not TTY.
expo --help
Usage: expo [options] [command]
Options:
-V, --version output the version number
-o, --output [format] Output format. pretty (default), raw
--non-interactive Fail, if an interactive prompt would
be required to continue. Enabled by default if stdin is not a TTY.
In that case you can all commands mentioned above:
expo init my-new-project
or do expo login first
Use normal CMD(Command Prompt) instead of using git-bash or some other terminals. It worked for me.
You can supply your credentials (expo website account credentials) by:
expo login -u YOUR-USERNAME-OR-EMAIL -p YOUR-PASSWORD
If you don't have one, go get one at : https://expo.io/
If you just starting learning React Native, and its necessary to run on Expo client on your mobile, you create app by:
react-native init ptojectName
This type of projects can run on simulator (android/ios) or on real device.
To allow it to work in git bash, just alias the expo command in your .bashrc or .profile to use gitbash's winpty, made for just this sort of thing:
In your .profile or .bashrc:
alias expo='winpty expo.cmd '
I had the same issue using gitbash, like it defaults in non-interactive mode you have to specify every arguments:
expo init myprojectname --template blank
Where "myprojectname" is the name you want to give
template is the start options expo init gives which are blank, tabs or bare-minimum
The issue is when you are using Git Bash, I solved it by using the in-built terminal on VS-code
If you are not in interactive mode, then you can specify template and workflow as shown below:
expo init demoProject --template blank --workflow managed
Hope this helps.
You can solve it by
1. Using cmd or PowerShell instead of git bash
or
2. Use git as an integrated terminal if you are using vscode as your text editor
My suggestion to you: start again. Install expo, then run:
expo init my-new-project
cd my-new-project
expo start
See here for details:
https://expo.io/learn
Your life will be much easier. Then, when you gain experience, you can start playing without it.
$ expo init --name non-interactive --template blank managed Awesome_project
I know this is a very old question but I had the same
Issues lately but all I did was to just use my windows command prompt instead of Gitbash.

any command for react-native just freezes and doesnt do anything

I encountered this issue on mac. Tryed everything, reinstalling node, npm, react-native. No luck.
$ react-native
And it just stands like that.
Figured it out. Altho its pretty wierd. You need to run react-native commands with sudo.
Example sudo react-native run
Edit: If you want to keep your env variables ( example: ANDROID_HOME ), just add -E right after sudo
Exampe sudo -E react-native run