Error: "ios.bundleIdentifier" is not defined in your app.config.js and we can't update this file programmatically. Add the value - react-native

I am trying to deploy a React Native App using eas build.
The app builds successfully on Android but not on IOS.
I see this error message which says ios.bundleIdentifier is not defined in app.config.js
But... it IS defined, as can be seen here:
import 'dotenv/config';
export default {
"name": "raterepositoryapp",
extra: {
env: process.env.ENV,
uri: process.env.APOLLO_URI
},
"expo": {
"extra": {
"eas": {
"projectId": "ecf6c94b-c096-4a5b-ab41-8dfdd36de96b"
}
}
},
"slug": "rate-repository-app",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"userInterfaceStyle": "light",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": [
"**/*"
],
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.webforprofessionals.rate-repository-app",
"buildNumber": "1.0.0"
},
"android": {
"package": "com.webforprofessionals.raterepositoryapp",
"versionCode": 1,
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
}
},
"web": {
"favicon": "./assets/favicon.png"
}
}
Why is the error coming up ?

I was able to finally discover the answer by using the EAS CLI command eas config --platform=ios --profile=preview (or whatever profile you want to test against). When you look at the output it gives you for app.config.js, you'll notice that there is no ios section shown and it's much smaller than your full app.config.js object. It is only using the eas portion of your app config.
I was able to fix the error by copying the ios config that's at the top-level of app.config.js into the expo portion of your config. I also moved the definition into a variable so I could use it in both places without repeating myself.
Edit:
After some more testing and documentation reading, I discovered what the real issue was. It appears that if you use app.config.js, the object you return is interpreted as the expo config... unless you also have an expo key inside that object. Then it only looks at what's in the expo part of your config. So what you really want to do is take your everything that's embedded under expo.extra and move it under extra.
Afterwards your app.config.js should look something like this:
export default {
name: "raterepositoryapp",
extra: {
env: process.env.ENV,
uri: process.env.APOLLO_URI,
eas: {
projectId: "ecf6c94b-c096-4a5b-ab41-8dfdd36de96b"
}
},
slug: "rate-repository-app",
// etc...
}
This is not obvious at all based on the error output, but after you realize which part of the file it's using, it's easy to address. I hope this works for you, too.
The documentation that tipped me off to this can be found here. You'll notice that wherever it uses the app.json format, you'll see everything nested under an expo key, but wherever it uses the app.config.js format, you'll see everything at the top-level of the object. That gave me the hint to start testing moving everything to the top level and do some testing.

Related

EAS updates not working possibly due to missing channel-name in Expo.plist

I'm trying to make EAS updates to work, after debugging, the issue seems to be the missing channel-name, which does not appear in Expo.plist, although,I believe, my eas.json is set up correctly.
I am not using anywhere in the app releaseChannel, replaced it with channel and I did rebuilt the app. Did anyone encounter this issue or knows a solution ? This is how I set the profile in eas.json:
“build”:{
"staging-1863": {
"channel": "staging-1863",
"env": {
"ENVIRONMENT": "staging"
},
"android": {
"buildType": "apk",
"credentialsSource": "local"
},
"ios": {
"credentialsSource": "local"
}
},
}

Parametrize android package and ios bundle id with EAS on Bare workflow

I'm currently working on a expo project and I had the bundle configuration parametrized with environment variables declared on eas.json and used on app.config.ts.
Some like this
eas.json
{
"cli": {
"version": ">= 0.48.2"
},
"build": {
"develop": {
"distribution": "store",
"env": {
"ENVIRONMENT": "develop"
},
"releaseChannel": "dev-v1"
},
"production": {
"releaseChannel": "prod-v1",
"env": {
"ENVIRONMENT": "production"
},
"distribution": "store"
}
}
app.config.ts
//removed a lot of not relevant code
ios: {
supportsTablet: true,
bundleIdentifier: getBundleId(), // returns correct bundle id based on ENVIRONMENT variable.
buildNumber: '1.0.4',
},
android: {
adaptiveIcon: {
foregroundImage: './assets/adaptive-icon.png',
backgroundColor: '#FFFFFF',
},
package: getBundleId(), // same of ios BundleIdentifier
versionCode: 104,
},
But now, for some requirements I have to eject the project into the bare workflow, and because of that I'm getting the follow message when I want to generate a new build with eas (with eas build -p=ios --profile=production)
Specifying "ios.bundleIdentifier" in app.config.ts is deprecated for bare workflow projects.
EAS Build depends only on the value in the native code. Please remove the deprecated configuration.
Does exist any way to keep bundleIdentifier, packageId and also the app schema parametrized by environment after eject?

Expo eject how to specify os

i'm using expo eject and my problem here is that it didn't even generate the ios folder, i only get android folder
but i neet it to generate both android and ios folder and i don't know how to specify that.
here is my app.json code :
"ios": {
"supportsTablet": true,
"bundleIdentifier" : "com.Belmwassel.IOS"
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/icon.png",
"backgroundColor": "#FFFFFF"
},
and here is the result of my command
I believe you need to be running MacOS for it to generate the iOS folder. Personally I think it should generate it anyways even if I can't do anything with it (I'm on Windows) but it's also possible there are some technical limitations.

There is no 'package.json' - node-webkit app

I'm making my first desktop application using node-webkit.
I followed all the steps to package the app on windows but I'm getting this error:
There is no 'package.json' in the package, please make sure the 'package.json' is in the root of the package.
Although the package is in the root.
sample package.json file
{
"name": "name of app",
"version": "1.0.0",
"main": "index.html",
"single-instance": true,
"node-remote": "<local>",
"window": {
"title": "name to show in title bar",
"icon": "icon to show in titlebar",
"position": "center",
"min_width": 1024,
"min_height": 600,
"toolbar": true,
"width": 1362,
"height": 768
},
"dependencies": {
"express": "3.x"
},
"webkit": {
"plugin": true
}
}
Ok I found my mistake. In fact, I was compressing the folder containing the package json and the other files. So what I made was like that:
App.zip
|
|-App
|-package.json
|-Other files
What is correct is this:
App.zip
|-package.json
|-Other files

Having trouble packaging node webkit app

I wrote a small app in node webkit, and am having trouble packaging it. My eventual goal is to have a .exe that I can give to other people.
I can run it from the command line with "nodewebkit".
I've tried zipping the files and saving the result as app.nw, but when I try to run that I just get the default node webkit screen. I've read through the docs on rogerwang github, but haven't gotten anywhere because I can't get through that first step.
The app consists of a few files: index.html, main.js, styles.css. It depends on a few node modules as well as jquery. The package.json file is pasted below... any suggestions would be much appreciated.
{
"name": "spl",
"version": "0.0.0",
"description": "",
"keywords": [],
"main": "index.html",
"homepage": "https://github.com/lpappone/spl",
"bugs": "https://github.com/lpappone/spl/issues",
"window": {
"title": "Splitter",
"toolbar": false,
"frame": true,
"width": 800,
"height": 500
},
"author": {
"name": "Lauren Pappone",
"email": "",
"url": "https://github.com/lpappone"
},
"repository": {
"type": "git",
"url": "git://github.com/lpappone/spl.git"
},
"dependencies": {
"fast-csv": "^0.5.3",
"recursive-readdir": "^1.2.0"
},
"devDependencies": {},
"engines": {
"node": ">=0.8.0"
}
}
The directory structure looks like this, and when I inspect the contents of the .nw, it is exactly the same:
You seem to be doing this on a Mac, so I'll cover that. Windows and Linux are slightly more complicated because they don't have App Bundles the way Mac OSX does.
Are you copying your app.nw to the right place? Are you sure you're including everything in app.nw?
Is this what you're doing?:
First you need to create app.nw, which is just a zip file of your entire project. If you go to your project dir (the one containing package.json) you can do this by typing
zip -r ../app.nw .
Now create a copy of node-webkit.app and copy app.nw into node-webkit.app/Contents/Resources/
cp app.nw node-webkit.app/Contents/Resources/
You should be able to run node-webkit.app now and it should run your app. (You might have some issues with security settings and such)
See https://github.com/rogerwang/node-webkit/wiki/How-to-package-and-distribute-your-apps#mac-os-x for further details.