microsoft / react-native-code-push

React Native module for CodePush
http://appcenter.ms
Other
8.98k stars 1.47k forks source link

CodePush is not work Expo 46.0.16 react-native 0.69.6 #2366

Closed augustovogt closed 9 months ago

augustovogt commented 1 year ago

Hi All, I am new in Code Push, I have following error in Android with Simulator or Devices: I am followin guide: https://github.com/microsoft/react-native-code-push/blob/HEAD/docs/setup-android.md seccion: 'Plugin Installation and Configuration for React Native 0.60 version and above (Android)' and also https://learn.microsoft.com/en-us/appcenter/sdk/getting-started/react-native for

Error: The CodePush module doesn't appear to be properly installed. Please double-check that everything is setup correctly.

TypeError: undefined is not an object (evaluating 'CodePush.CheckFrequency') at node_modules/react-native/Libraries/Core/ExceptionsManager.js:95:17 in reportException at node_modules/react-native/Libraries/Core/ExceptionsManager.js:141:19 in handleException at node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:39 in handleError at node_modules/expo/build/errors/ExpoErrorManager.js:25:19 in errorHandler at node_modules/expo/build/errors/ExpoErrorManager.js:30:24 in at node_modules/@react-native/polyfills/error-guard.js:49:36 in ErrorUtils.reportFatalError at node_modules/metro-runtime/src/polyfills/require.js:203:40 in guardedLoadModule at http://192.168.1.48:19000/index.bundle?platform=android&dev=true&hot=false&strict=false&minify=false:null in global code

Invariant Violation: "main" has not been registered. This can happen if:

Extract My App,js

import CodePush from "react-native-code-push"

codePushOptions = { checkFrequency: CodePush.CheckFrequency.MANUAL };

App = CodePush(codePushOptions)(App);

export default App;

My package.json:

"dependencies": { "appcenter": "4.4.5", "appcenter-analytics": "4.4.5", "appcenter-crashes": "4.4.5", "expo": "~46.0.16", "expo-splash-screen": "~0.16.2", "expo-status-bar": "~1.4.0", "react": "18.0.0", "react-dom": "18.0.0", "react-native": "0.69.6", "react-native-code-push": "^7.0.5", "react-native-web": "~0.18.7" }, "devDependencies": { "@babel/core": "^7.12.9" }, "private": true

I have tried different options and nothing

Can I use code push with expo?

Could someone please give me some guidance?

Thanks.

ammarkdn commented 1 year ago

up

pnthach95 commented 1 year ago

CodePush can't work with Expo app, but I think bare workflow app can. Expo has expo-updates same as CodePush. Why don't you use it?

hugohow commented 1 year ago

Maybe because codepush is free and expo-updates is really expensive

deggertsen commented 1 year ago

I've submitted a pull request for review, but until it's actually approved and usable you can go here to get the plugin to manually add it to your Expo project. Keep in mind that react-native-code-push will not work with a managed expo app. Using this plugin will require you to use the bare workflow, but it will do all of the codepush configuration for you so that you shouldn't need to touch the native build files.

https://github.com/deggertsen/react-native-code-push-expo-plugin

jakobsuckow commented 1 year ago

@deggertsen With the forthcoming PR, do I still need to switch my expo managed workflow to the bare workflow ?

deggertsen commented 1 year ago

@deggertsen With the forthcoming PR, do I still need to switch my expo managed workflow to the bare workflow ?

I'm using the bare workflow. It might be possible to do it with managed, but I'm not sure.

jakobsuckow commented 1 year ago

@deggertsen With the forthcoming PR, do I still need to switch my expo managed workflow to the bare workflow ?

I'm using the bare workflow. It might be possible to do it with managed, but I'm not sure.

Thanks for the reply

microsoft-github-policy-service[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs within 15 days of this comment.

deggertsen commented 1 year ago

I believe this is still an active issue so long as the PR is still open.

bryanltobing commented 1 year ago

Maybe because codepush is free and expo-updates is really expensive

I believe you can use your own server @hugohow

LukePJN commented 1 year ago

Would be really cool if it worked on an expo-managed workflow.

mgscreativa commented 1 year ago

I've submitted a pull request for review, but until it's actually approved and usable you can go here to get the plugin to manually add it to your Expo project. Keep in mind that react-native-code-push will not work with a managed expo app. Using this plugin will require you to use the bare workflow, but it will do all of the codepush configuration for you so that you shouldn't need to touch the native build files.

https://github.com/deggertsen/react-native-code-push-expo-plugin

Hi! did your PR got approved?

deggertsen commented 1 year ago

Hi! did your PR got approved?

Still awaiting review. The PR could also be improved if anyone wanted to contribute. https://github.com/microsoft/react-native-code-push/pull/2415

mgscreativa commented 1 year ago

Hi! how can I contribute to it? I was thinking on build test and try to push forward for approval, but I have little to none experience with this, so if you help me go through it, I can contribute

mgscreativa commented 1 year ago

Hi! continuing with this issue, I think CodePush shuld explicitly support Expo projects. I tried the plugin by @deggertsen and it works but trying to send a deployment with CodePush fails in an Expo managed workflow project, because it lacks of /android and /ios folders. Any Workaround?

More info here https://github.com/deggertsen/react-native-code-push-expo-plugin/issues/2#issuecomment-1668809785

Mukhammadali commented 1 year ago

@mgscreativa Did you try it with an expo-managed custom dev client which enables using 3rd party native libraries using expo config plugins without ejecting or migrating to bare workflow?

mgscreativa commented 1 year ago

Hi! @Mukhammadali thanks for your answer, I have published a test repo here https://github.com/mgscreativa/react-native-code-push-expo-plugin-managed-workflow

It uses Expo dev client and yesterday I was able to push a boundle through CP. Will write my findings later.

mgscreativa commented 1 year ago

Hi! did your PR got approved?

Still awaiting review. The PR could also be improved if anyone wanted to contribute. #2415

Hi @deggertsen what can I do to contribute and push this PR for approval?

mgscreativa commented 1 year ago

Hi @Mukhammadali here you have my updated repo with plenty of documentation about the process to get this working. I confirm it does work flawlessly! https://github.com/mgscreativa/react-native-code-push-expo-plugin-managed-workflow

Mukhammadali commented 1 year ago

Hi @Mukhammadali here you have my updated repo with plenty of documentation about the process to get this working. I confirm it does work flawlessly! https://github.com/mgscreativa/react-native-code-push-expo-plugin-managed-workflow

Thanks man

deggertsen commented 1 year ago

Hi! did your PR got approved?

Still awaiting review. The PR could also be improved if anyone wanted to contribute. #2415

Hi @deggertsen what can I do to contribute and push this PR for approval?

There were some requests from a reviewer on the PR. I think I solved all of them, but it may be beneficial for a second set of eyes to look over the requests and see if there is anything I missed.

I approved your PR to my plugin repo. I would think that some of those additions may be beneficial to the code-push PR?

mgscreativa commented 1 year ago

I have look at the PR code and my PR to your plugin repo is based on this PR and tested as in my demo repo for Expo Dev Clients.

So I think that this PR should be approved.

Maybe you can guide me to build instructions for this package to double check everything builds correctly, but apart from this, I think that some package mantainer should point us what else may be done for PR approval.

mgscreativa commented 1 year ago

Just wonder which requests from a reviewer on the PR are they? can you enumerate them?

deggertsen commented 1 year ago

The suggestions here are what I referred to. I think I addressed them all already, but might be good to double check. https://github.com/microsoft/react-native-code-push/pull/2415#pullrequestreview-1466839092

mgscreativa commented 1 year ago

I have double checked the code and seems legit

deggertsen commented 1 year ago

I guess we're just waiting on approval for the merge then.

brentvatne commented 1 year ago

reaching out on behalf of the Expo team here -- if the folks working on CodePush run into any issues with supporting Expo apps, just let us know and we can help out! as far as I know, the process should be the same as integrating any other native library that requires a config plugin. it looks like @mgscreativa's PR #2415 handles that well!

mgscreativa commented 1 year ago

Thanks @brentvatne but all credits go to @deggertsen!

microsoft-github-policy-service[bot] commented 9 months ago

This issue has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs within 15 days of this comment.

microsoft-github-policy-service[bot] commented 9 months ago

This issue will now be closed because it hasn't had any activity for 15 days after stale. Please feel free to open a new issue if you still have a question/issue or suggestion.