so basically the app runs fine on android/iOS but doesn't run on web
These are the following persistent errors
I apparently have figured it has something to do with Webpack(v5?) and react-scripts,
have already downgraded Webpack and added the react-error-overlay but still these errors pop-up
This is my App.js
import { StatusBar } from 'expo-status-bar';
import { StyleSheet, Text, View,Platform } from 'react-native';
export default function App() {
return (
<View style={styles.container}>
<Text>Hi! Welcome</Text>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
flexDirection:'column',
alignSelf:'stretch',
alignItems:'center',
...Platform.select({android:{backgroundColor:'orchid'}})
},
});
This is my package.json
{
"name": "bigapp",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"preinstall": "npx npm-force-resolutions",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"dependencies": {
"expo": "~46.0.9",
"expo-status-bar": "~1.4.0",
"react": "18.0.0",
"react-native": "0.69.5",
"react-scripts": "^4.0.3",
"webpack": "^4.46.0",
},
"devDependencies": {
"#babel/core": "^7.12.9",
"react-error-overlay": "^6.0.9"
},
"private": true
}
Any help is appreciated
So after 18+ hours trying fixes and encountering the same errors...
I have done the following
1)Removed the project and re-installed it using yarn
2)downgraded react to 17.0.2
3)downgraded react-native to 0.68.2
4)downgraded expo to 45.0.0
5)Added the react-error-overlay to 6.0.9 in package.json
This is my package.json
{
"name": "bigApp",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web"
},
"dependencies": {
"expo": "^45.0.0",
"expo-status-bar": "~1.3.0",
"react": "17.0.2",
"react-native": "0.68.2",
"react-scripts": "5.0.0"
},
"devDependencies": {
"#babel/core": "^7.12.9",
"react-error-overlay": "6.0.9"
},
"resolutions": {
"react-error-overlay": "6.0.9"
},
"private": true
}
Still I have no idea how webpack(v5) is fine with outdated dependencies but nonetheless it works.
This might be useful to someone facing similar issues...
Other solutions are welcome.
Related
I am trying to install a react native application using expo. I have tried all the updating packages and more from previous answers without any success.
It is however failing and giving me this error on the web interface: An unexpected error has occurred.
And on the console, it shows me this error message:
ReferenceError: process is not defined
at Module.RNiq (index-1b0e10d3020a016605d2.js:1:237007)
at l (webpack-e067438c4cf4ef2ef178.js:1:563)
at index-1b0e10d3020a016605d2.js:1:457536
at main-41e61ebd24edb78847da.js:1:19485
at main-41e61ebd24edb78847da.js:1:19653
ue # main-41e61ebd24edb78847da.js:1
My package.json is
{
"name": "my-app",
"version": "1.0.0",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"expo": "~45.0.0",
"expo-status-bar": "~1.3.0",
"react": "17.0.2",
"react-dom": "17.0.2",
"react-native": "0.68.2",
"react-native-web": "0.17.7"
},
"devDependencies": {
"#babel/core": "^7.12.9"
},
"private": true
}
error image
I was using expo-cli version 5.4.10 but on rolling back to expo-cli version 5.4.9 it worked. Find the various npm expo versions here
I am trying to use webrtc in my react native app but whenever i install my app , it closes automatically this starts happening after I installed the react-native-webrtc package in my app ,before that my app was working
here's my package.json
{
"name": "demoApp",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"react": "16.11.0",
"react-native": "0.62.1",
"react-native-webrtc": "^1.75.0"
},
"devDependencies": {
"#babel/core": "^7.9.0",
"#babel/runtime": "^7.9.2",
"#react-native-community/eslint-config": "^1.0.0",
"babel-jest": "^25.2.6",
"eslint": "^6.8.0",
"jest": "^25.2.7",
"metro-react-native-babel-preset": "^0.59.0",
"react-test-renderer": "16.11.0"
},
"jest": {
"preset": "react-native"
}
}
I even tried 1.75.1 and 1.75.0 version of react-native-webrtc but still Same Issue
After install react-native-webrtc package,
you have to follow this guide.
Simply add this in your gradle.properties:
android.enableDexingArtifactTransform.desugaring=false
and enjoy!
I'm new to React Native. I get import errors like this when I try to import a class from another file in React Native. How can I resolve this ? (I'm using react-navigation 2.18.3)
C:/Users/Suman Shaw/Login/components/Login.js
Module not found: Can't resolve '../config/firebaseSDK' in 'C:\Users\Suman Shaw\Login\components'
[![my folder hierarchy][1]][1]
package.json
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"expo": "~36.0.0",
"firebase": "^7.9.3",
"react": "~16.9.0",
"react-dom": "~16.9.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz",
"react-native-gifted-chat": "^0.13.0",
"react-native-web": "~0.11.7",
"react-navigation": "^2.18.3",
"uuid": "^7.0.1"
},
"devDependencies": {
"babel-preset-expo": "~8.0.0",
"#babel/core": "^7.0.0"
},
"private": true
}
Can't resolve '../config/firebaseSDK' means you are giving wrong path
import as '../../'till you find config
you can refer this https://www.youtube.com/watch?v=ephId3mYu9o
I am getting the following error on creating the navigation stack as follows:
Unable to resolve "./vendor/TransitionConfigs/CardStyleInterpolators" from "node_modules/react-navigation-stack/lib/module/index.js"
App.js:-
import React from "react";
import {createAppContainer,createSwitchNavigator} from "react-navigation";
import {createStackNavigator} from "react-navigation-stack";
import {createBottomTabNavigator} from "react-navigation-tabs";
import AccountScreen from "./src/screens/AccountScreen";
import SigninScreen ...... ;
const switchNavigator=createSwitchNavigator({
loginFlow:createStackNavigator({
Signin:SigninScreen,
Signup:SignupScreen
}),
mainFlow:createBottomTabNavigator({
trackListFlow:createStackNavigator({
TrackList:TrackListScreen,
TrackDetails:TrackDetailsScreen
}),
TrackCreate:TrackCreateScreen,
Account:AccountScreen
})
});
export default createAppContainer(switchNavigator);
I am using the following dependency version:-
Package.json:-
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"expo": "~36.0.0",
"react": "~16.9.0",
"react-dom": "~16.9.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz",
"react-native-gesture-handler": "^1.5.3",
"react-native-reanimated": "^1.4.0",
"react-native-web": "~0.11.7",
"react-navigation": "^4.0.10",
"react-navigation-stack": "^1.10.3",
"react-navigation-tabs": "^2.7.0"
},
"devDependencies": {
"babel-preset-expo": "~8.0.0",
"#babel/core": "^7.0.0"
},
"private": true
}
While bundling I am getting the following error although I am using stable version of all the dependencies...
You need to clear your metro Cache.
Since you're using Expo, first stop Expo server. Then run:
expo start -c
If you're not, run:
react-native start --reset-cache
So, I deleted and reinstalled everything possible for React Native. I began to get an error for expo. In the terminal a reoccurring error was .json is missing. I don’t know how to fix this. I’m new to React and using a Mac. I was in the middle of a tutorial when it all stopped working. Thank you in advance!
Please create package.json file in your project root folder and past below code and update according to your requirement like project name or description:
{
"name": "expo-template-tabs",
"description": "The Tab Navigation project template includes several example screens.",
"version": "0.0.2",
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"eject": "expo eject",
"test": "node ./node_modules/jest/bin/jest.js --watchAll"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"#expo/samples": "2.1.1",
"expo": "^31.0.5",
"react": "16.5.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-31.0.0.tar.gz",
"react-navigation": "^3.0.1"
},
"devDependencies": {
"babel-preset-expo": "^5.0.0",
"jest-expo": "^31.0.0"
}
}
Then run below command:
- npm install
I hope it would help you out.