I am building an app using Expo but for some reason all of a sudden the 'npm' start command no longer works - react-native

I am fairly new to React Native. I am building a basic app using expo-cli. I don't have a deep understanding on how it works, but I've been following tutorials online on how to use it. Today, I was working on it and used 'npm start' command to launch the expo portal so I could demo my app on a virtual machine but it says it can no longer find the link to the .json file. Can someone please help me to get it working again.

Looks like you're one directory up? Try cd WhatsUp and then run npm start again.

Related

Why development server doesn't open on new tab when I run 'npm start' in react-native?

I am quite new to react-native and was following youtube tutorial for learning purposes. I have created basic react-native app with expo init FirstProject. Everything is working fine but when I run npm start, development server does not open on new tab. In every tutorial when npm start is run, it starts development server like this development server. Thats not case for me, I have tried several solutions but none has worked me. I haven't changed any file at all, so I hope there is no purpose of sharing my App.js as it is default. I don't get any errors, but still development server doesn't open in new tab. This is what I get: My terminal after I run npm start. Help would be greatly appreciated.
The Web UI is no longer part of the expo-cli, it was removed in version 6.0.0. You are most likely watching tutorials that are using versions prior to that release.
If you would like to read more, here is the official post from Expo: https://blog.expo.dev/sunsetting-the-web-ui-for-expo-cli-ab12936d2206.

Expo: Can't find variable require

Dear stackoverflow community,
I'm not able to find any solution online for my problem. My error is the following:
Can't find variable: require
http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=android&dev=true&minify=false&hot=false:5:24
global code#http://127.0.0.1:19001/node_modules/expo/AppEntry.bundle?platform=android&dev=true&minify=false&hot=false:701:3
Screenshot Expo Error
It was working perfectly 2 days ago, and (apparently) I didn't change anything since then.
Do you have any idea where it can come from?
I'm using:
expo#~3.0.10
react-native "https://github.com/expo/react-native/archive/sdk-38.0.0.tar.gz"
Very basic configuration. I'm suspecting some kind of miss configuration...
Thanks in advance!
Regards,
Guillaume
Updates 09-02-2020 4pm20:
I tried cleaning caches,
I tried changing directory,
I tried expo init a new app, importing the sources of the previous app, installing dependencies, it worked until I ran expo start -c, then the problem came back,
Still working on it...
Updates 09-02-2020 7pm:
I finally succeed to make it work.
Update expo-cli to the latest version
Initialize a new expo app in another directory
Copy/paste source code
Use expo start -c instead of expo start to make sure no cache is involved in the following steps
Install dependencies one by one to make sure none is the problem
Finally test the app
try by adding, import React from 'react' in the file where you mentioned require
first : expo r -c ,
then : npm start,
finally: use require function

Expo not publishing

When I try to publish my Expo apps, it seems to have problems with apps that have un-optimized assets. I try to run expo optimize on these but sometimes I can't get this to work so I try publishing anyway, from the browser console, and it never finishes. I tried this earlier today and it got through Optimizing assets... in the publish process, and then go stuck on Building Javascript Bundle. Right now I'm trying again and it appears to be stuck on Optimizing /Users/TuzMacbookPro2017/Development/QMG-local/APPS/ELECTRO/assets/electro-icon-1024.png.
Even with this un-optimized asset I can get through expo build:ios without any apparent problems.
Any solutions?
I had the same problem. Could not publish from the web console.
I am using: Expo SDK 35, expo-cli 3.1.0
I managed to publish the app from the command line at my project root.
first, run:
expo optimize
second run:
expo publish
When the process finishes, the cli will then output an URL that you can visit to check the published app.
Something like this:
https://exp.host/#profileUsername/appName
I hope this helps.

react-native create app hangs while create

I use react-native with actual version and have tried to create a simple project. But while trying to create it by using
expo init AwesomeProject
the whole process hangs.
I have tried to look for a solution by searching on the internet but without any luck.
The error could be seen in the following screenshot:
That error generally means that a file is being accessed by two different things at 'around' the same time. And 90% of those times it is because of an anti-virus or similar.
Its a permission error, so my advice, try to do it after a fresh reboot and boot the powershell as admin, disable antivirus etc..
If still does not work reinstall nodejs/npm.
I had the same experience. The project gets created using React-native. When you try to run it, the 'Metro' interface comes up. There is an android phone on the USB drive which has previously been used to run Android Studio created projects successfully. However, on the command shell the app hangs in Metro.
While trying to run the project from Android Studio snow cat, there are build errors (red) in the App manifest file and there is this exception.
Build failed due to java.lang.NullPointerException
Installed expo-cli (C:\Reactive-native>npm install -g expo-cli). The app fails to run and hangs on the connected Android phone(Samsung 21) using the Expo Go client. This client has no problem having been tested in Snackbar.
I have a question in the Expo forum and probably someone will answer!

React Native not installing properly

I am familiar with React Native. I got a new macbook and I am trying to create a new file. However, when I run create-react-native-app [name of app] I am greeted with:
This command requires Expo CLI.
Do you want to install it globally [Y/n]?
When I pressed Y it created the file, however, in a complete file layout. It looked so odd and there were some files missing too.
Normally, when I run create-react-native-app it created the file without asking anything about expo. I am pretty confused. I'm pretty sure I have done wrong somewhere. Where and how I can get the traditional installation process back?
I also know that expo helps with testing. Since may I have been using npm start and npm run ios to test my apps on device and xcode simulation.
https://facebook.github.io/react-native/docs/getting-started I followed this.
New version out now and create react native app has been merged with expo CLI.
To avoid any bug use new version to create react apps, follow the command bellow which is also in the link given in your question.
expo init AwesomeProject
After installation you will be guided to start project with expo start.
cd AwesomeProject
expo start