Lab: How to setup an Expo project:

Step 1: Install Expo CLI Locally

First, ensure that you have a package.json file in your project directory (C:\lab_react_jokesv4). If you don't have one, you can create it by running:
shCopy code
npm init -y

Then, install the Expo CLI in your project directory:
npm install expo-cli --save-dev

Step 2: Initialize Expo Project

If you haven't already created an Expo project, you can do so by running:
npx expo init my-new-expo-project

As of Nov 3, 2023: package versioning requires for local expo project:

This will create a new folder my-new-expo-project with all the necessary Expo files. If you want to create the project in the current directory instead, you can use the . character:

✅ Your project is ready!

To run your project, navigate to the directory and run one of the following npm commands.

- cd my-app
- npm run android
- npm run ios # you need to use macOS to build the iOS project - use the Expo app if you need to do iOS development without a Mac
- npm run web
PS C:\lab_expo_project> npx expo init my-new-expo-project

$ expo init is not supported in the local CLI, please use npx create-expo-app instead

Follow the prompts to choose a template and configure your project.

Step 3: Install Dependencies

Make sure all dependencies are installed. If you just initialized a new project, this should be done automatically. If not, or to ensure all dependencies are up to date, run:
npm install

Step 4: Start the Expo Project

Now, you can start the Expo project by running:
shCopy code
npx expo start

This command should start the Expo developer tools in your browser.


If you encounter the message "Unable to find expo in this project," it's likely that the dependencies haven't been installed correctly, or the package.json file is missing or incorrectly set up. Make sure you're in the right directory where your Expo project is located and that you've run npm install to install all the necessary packages.

Note on Node Version

The warning about the legacy expo-cli not supporting Node +17 indicates that you're using a version of Node.js that is newer than what the old global expo-cli package supports.
By installing the Expo CLI locally in your project, you should bypass this issue. If you continue to encounter problems, consider using Node Version Manager (nvm) to switch to a supported version of Node.js for the project.
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
) instead.