Unable to find expo project - have you run yarn / npm install yet? - reactjs

I'm Unable to execute the expo start command.
$ expo start
[09:43:39] Starting project at C:\Users\Subrata\Desktop\example-app
[09:43:40] Unable to find expo in this project - have you run yarn / npm install yet?

either you havent installed dependencies yet, which you can do by running npm install, or you might be outside the project folder, in which case just run cd projectName

Related

Error installing the Expo CLI, running command "npm install expo-cli --global"

I'm trying to start a React Native application, But when I try to install the Expo CLI running any of the commands below, it returns this error:
npm WARN config global --global, --local are deprecated. Use --location=global instead.
npm ERR! Unexpected token '.'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Amro\AppData\Local\npm-cache_logs\2022-07-21T18_29_03_950Z-debug-0.log
Commands tried:
"npm install expo-cli --global"
"npm install --global expo-cli"
"npm install expo-cli --location=global"
If anybody has any suggestion on how to install the Expo CLI, I would very much appreciate it, thanks.
Have you tried installing without the global tag?
npm install expo-cli
I started a blank project and this worked fine.
Triple check you are in the correct file location when running the command. If you are new to expo/npm/etc, double check you are using correct versions of Node.js and Npm, as well as having correctly set up environment variables. Please reply to this comment if this doesn't work and you have further questions.
As of Expo v46 the CLI is part of the local expo package. There is no need to install the global package.
Use npx expo start to start your app.
npx will look in the node_modules of your current directory first, and because the expo package includes the expo-cli bin it will be invoked.
This makes maintaining older apps MUCH easier.
Details in the blog post.
The New Expo CLI

how to run an already ready app in react js with npm

npx create-react-app my-app
cd my-app
npm start
This is how I created a react app. But if I get an already ready app in react how will I run it?
Inside the project directory run: npm install, this will install all of your project dependencies, and after that, you can start the app with the npm start command.
Open the Terminal,
Go to Project Directory
Use this command
npm install
It will install all the dependencies that are necessary to run this project.
Now run the development server
npm start
Development:
npm install
npm start
Production*:
./build/index.html
*if build folder doesn't exist then execute:
npm run build

How can i solve "No project found" error when installing react

I am new to react and i am taking my first course on openclassrooms on react.
The instructor is using the command
yarn global add create-react-app
to setup but when i run the commdand i get the error below
Usage Error: No project found in /E:/Web Dev/React/react-project
i have tried to use the command below that is provided in the react documentation but i stil get the same error
yarn create react-app my-app
How can i solve the problem i have looked up on the react documentation but still cannot find the solution.
I experienced the same issue and solved it as follows:
Uninstall yarn from npm using npm uninstall -g yarn
Install Yarn from Installation - Yarn Classic
Restart PowerShell / CMD
Before performing the above steps yarn --version printed 2.0.0-rc.27 on my machine. Now it prints 1.22.4.
Having Yarn 2.x globally installed is discouraged accourding to Installation - Yarn 2.x.

Failed to run jetifier React Native

I tried to run react-native run-android and I got this error.
info Running jetifier to migrate libraries to AndroidX. You can disable
it using "--no-jetifier" flag.
error Failed to run jetifier. Run CLI with --verbose flag for more details.
Error: spawnSync C:\Users\JayK\Desktop\React\AwesomeProject\node_modules\jetifier\bin\jetify ENOENT
at Object.spawnSync (internal/child_process.js:1002:20)
at spawnSync (child_process.js:614:24)
at execFileSync (child_process.js:642:13)
at Object.runAndroid [as func] (C:\Users\JayK\Desktop\React\AwesomeProject\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:101:41)
at Command.handleAction (C:\Users\JayK\Desktop\React\AwesomeProject\node_modules\#react-native-community\cli\build\cliEntry.js:160:21)
at Command.listener (C:\Users\JayK\Desktop\React\AwesomeProject\node_modules\commander\index.js:315:8)
at Command.emit (events.js:198:13)
at Command.parseArgs (C:\Users\JayK\Desktop\React\AwesomeProject\node_modules\commander\index.js:651:12)
at Command.parse (C:\Users\JayK\Desktop\React\AwesomeProject\node_modules\commander\index.js:474:21)
at setupAndRun (C:\Users\JayK\Desktop\React\AwesomeProject\node_modules\#react-native-community\cli\build\cliEntry.js:210:24)
Use this :
step 1: add these two lines in gradlew.properties Visit for complete guideline
android.useAndroidX=true
android.enableJetifier=true
step 2: use these commands
First of all remove node_modules folder and reinstall it using
npm install
or
yarn
and then
npm install --save-dev jetifier
npx jetify
npx react-native run-android
Call
npx jetify
every time when (your dependencies update or every time you install node_modules you have to jetify again)
When I was getting this error I noticed that I'm not in the main project folder I was inside the cd android folder. So I just cd .. it and it worked.
Use this:
react-native run-android --no-jetifier
If you run npx react-native run-android in android folder. That error will happen. You need to run-android in the root directory.
I'm using yarn so I had to use
yarn react-native run-android --variant=release
(Not npx)
Also to run in the simulator (not on a device) I had to install some extra stuff in Android Studio, see https://stackoverflow.com/a/64942777/3469524
react-native run-android --no-jetifier
and again start server
react-native start
Mostly it happened by cache, metro server closed or already generated package in android folder. check jetifier is enabled in gradle.proporties
android.useAndroidX = true
android.enableJetifier = true
First close your metro server terminal window and run $ yarn android // this is almost solve your issue otherwise follow the below steps
Then run
$ cd android && ./gradlew clean
Clean the cache and build folders - generated & intermediates
$ ./gradlew cleanBuildCache
Create the debug apk
$ ./gradlew AssembleDebug //output: Build successful
then check your apk output folder.
Run the react native package
$ yarn android || npx react-native run-android
Now it's working fine.
The issue is in React Native CLI v2.6.1
Use Below steps to resolve the issue:
If you use lock files (yarn.lock or package-lock.json) - find the #react-native-community/cli entry, remove it, run yarn install / npm install once again.
If you don't use lock files – remove node_modules and run yarn install / npm install again.
Run yarn list #react-native-community/cli or npm list #react-native-community/cli and verify you're on the latest version (v2.6.2).
Run react-native run-android
Just run the following command in the project's directory:
npm install --save-dev jetifier
Check current directory set to project root and then run npx react-native run-android
Just change from "C" directory to any other directory and then install/run starting from here
"npm install -g react-native-cli" .
Then create new project "react-native init AwesomeProject "
use Yarn to install dependencies fast.
It worked for me.
I use this react-native run-android --no-jetifier worked me

How to install and run project in github

Im a newbie in Reactjs. I get project from github but cant run it though i npm install and npm run build it. Here is the project i try to install in my computer: https://github.com/iuliaL/diagonistician-ReactJS-Express-Mongoose-RestAPI
Thank you very much, << sorry but stackoverflow doesnt allow me post this question so i type some line >>
Try to follow these steps.
Git clone... git clone https://github.com/iuliaL/diagonistician-ReactJS-Express-Mongoose-RestAPI.git
Enter into project directory... cd diagonistician-ReactJS-Express-Mongoose-RestAPI
Install npm dependancy npm install
start npm server npm run build
that's all. Now browse to localhost: on browser.

Resources