So I've been following this tutorial: youtube.com/watch?v=qSRrxpdMpVc to try and learn react native for app development and I've been plagued with issues. After using expo to create a project using expo-template-blank by running:
expo init first
And then creating this very simple app like I was taught in the tutorial:
import React, {useState} from 'react';
import { StyleSheet, Text, View, Button } from 'react-native';
export default function App() {
const[outputText, setOutputText] = useState('New State');
return (
<View style={styles.container}>
<Text>{outputText}</Text>
<Button title="Change Text" onPress={() => setOutputText('the text changed')}/>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
},
});
I tried to test the app by cd to the directory and then running
yarn start
but when I did I got this massive error:
C:\www\first>yarn start
yarn run v1.21.0
warning ..\package.json: No license field
$ expo start
Starting project at C:\www\first
Expo DevTools is running at http://localhost:19002
Opening DevTools in the browser... (press shift-d to disable)
error Invalid regular expression: /(.*\\__fixtures__\\.*|node_modules[\\\]react[\\\]dist[\\\].*|website\\node_modules\\.*|heapCapture\\bundle\.js|.*\\__tests__\\.*)$/: Unterminated character class. Run CLI with --verbose flag for more details.
SyntaxError: Invalid regular expression: /(.*\\__fixtures__\\.*|node_modules[\\\]react[\\\]dist[\\\].*|website\\node_modules\\.*|heapCapture\\bundle\.js|.*\\__tests__\\.*)$/: Unterminated character class
at new RegExp (<anonymous>)
at blacklist (C:\www\first\node_modules\metro-config\src\defaults\blacklist.js:34:10)
at getBlacklistRE (C:\www\first\node_modules\@react-native-community\cli\build\tools\loadMetroConfig.js:66:59)
at getDefaultConfig (C:\www\first\node_modules\@react-native-community\cli\build\tools\loadMetroConfig.js:82:20)
at load (C:\www\first\node_modules\@react-native-community\cli\build\tools\loadMetroConfig.js:118:25)
at Object.runServer [as func] (C:\www\first\node_modules\@react-native-community\cli\build\commands\server\runServer.js:82:58)
at Command.handleAction (C:\www\first\node_modules\@react-native-community\cli\build\index.js:164:23)
at Command.listener (C:\www\first\node_modules\commander\index.js:315:8)
at Command.emit (events.js:210:5)
at Command.parseArgs (C:\www\first\node_modules\commander\index.js:651:12)
Metro Bundler process exited with code 1
Set EXPO_DEBUG=true in your env to view the stack trace.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Does anyone know what could be causing this? I am so frustrated by react because just getting react to install in the first place was a hassle with errors and now I can't even test a very simple app. I appreciate the help, thanks in advance!