0

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!

ShLuBsTeR
  • 69
  • 2
  • 8
  • Are you using a regex somewhere? If no try deleting node_modules and run yarn install and try again. – Atin Singh Dec 11 '19 at 01:00
  • I think this might help you . https://stackoverflow.com/questions/46947332/where-to-set-expo-debug-value-in-reactnative-app – learner62 Dec 11 '19 at 07:33
  • please check this answer https://stackoverflow.com/questions/58120990/how-to-resolve-the-error-on-react-native-start/58122821#58122821 – Zeeshan Ansari Dec 11 '19 at 12:45
  • @AtinSingh @AtinSingh thanks deleting node modules and reinstalling yarn worked for me, but then when i run yarn start, the app launches but then at the top of the page it says 'Expo Developer Tools is disconnected from Expo CLI. Use the expo start command to start the CLI again'. I noticed in cmd I'm getting the following error as well: error: unknown option `--assetPlugins' do you know what this would be about? Thanks! – ShLuBsTeR Dec 11 '19 at 22:08

0 Answers0