I type the command in cmd: npx create-expo-app loginHAT when creating the project in the loginHAT folder there is no App.js file? How to fix this error ?
Loading
I type the command in cmd: npx create-expo-app loginHAT when creating the project in the loginHAT folder there is no App.js file? How to fix this error ?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Dong Lam TrienPosted May 9, 2024, 1:52 AM
Before, I still used the command: npx create-expo-app newproject to create the project, in the project folder there was App.js, now I use it again without the App.js or App.tsx file, I don't know. What is the error that the App.js file cannot be created? Please see the attached image file
Naimish MakwanaPosted May 8, 2024, 9:55 AM
The command you’re using
npx create-expo-app loginHATis for creating a new Expo project. However, starting from Expo SDK 41, the main application file is no longerApp.js, butApp.tsxinstead. This is because Expo has moved to TypeScript for the main application file.If you’re looking for the
App.jsfile, you might want to check forApp.tsxinstead. If you want to use JavaScript instead of TypeScript, you can renameApp.tsxtoApp.jsand adjust the code accordingly.Here’s a basic
App.jscontent you can start with if you don’t have one:You can replace the content of
App.tsxwith the above code after renaming it toApp.js. Remember to install all the necessary dependencies and runexpo startto start your Expo app.Thanks
Jayraj ChhayaPosted May 8, 2024, 9:33 AM
When using Expo CLI to create a React Native project, the default entry point file is
App.js. If the file is missing after project creation, it might be due to a version mismatch or an issue during project initialization.To fix this error, you can manually create the
App.jsfile in the project directory. Here is an example of how you can create a basicApp.jsfile:After creating the
App.jsfile, make sure to run the project again to see if the issue is resolved. If the problem persists, consider updating Expo CLI or checking for any installation errors during project setup.