WebStorm not running project, Command `start` unrecognized - javascript

I'm very new to React Native, barely two weeks into it. I've installed node.js (ver 10.15.0), I've also installed yarn and downloaded WebStorm.
The problem is that I can't run a simple project created by WebStorm, it throws an error
Command start unrecognized. Make sure that you have run npm install and that you are inside a react-native project.
I've cd into my WebStorm projects folder and run npm install in command prompt countless times but it's still throwing the error. Some online suggestions said I should set my path correctly, but I don't really know how to go about it.
Any help will be appreciated.

You should know The best IDE for react native is VSCode (visual studio code) and don't create project with IDE (you should use commands for create project. just use IDE for manage codes)
use CMD or PowerShell (Recommended) for commands
Create a folder for your project and in the project directory run this commands :
npm install -g expo-cli
expo init Yourprojectname
cd Yourprojectname
npm start
For run android project
react-native run-android
For run android project
react-native run-ios
Also its better to read this tutorial : https://facebook.github.io/react-native/docs/getting-started

Related

how to run cloned/github remote react native app, err msg no android

NOTES: Im new in react native and i see there are so many approaches and with this error i thought the developer who built this app build it differently from what i learn so i don't understand why he didn't put the android folder
so i just joined a project and im going to run the apps in my pc by cloning it from github but when i try to npx react-native run-android it failed to run and the log is like this
error Android project not found. Are you sure this is a React Native project?
If your Android files are located in a non-standard location (e.g. not inside 'android' folder),
consider setting project.android.sourceDir option to point to a new location.
info Run CLI with --verbose flag for more details.
the folder structure is like this
The files show that the project is created with Expo. Specifically, you have a managed expo project.
npx react-native run-android would compile an android app from source, with Expo's managed workflow that's not needed. You will need the Expo Go App.
Expo also comes with its own commands to start the bundler. Instead of running npx react-native ... make use of the expo-cli running: npx expo start
However, in the package.json there is very likely a script called start. In that case, it's easier for you to run npm start.
After running this command the expo console opens. Here you can press a to open the app using expo go (or instructions on how to do so).
Alternatively, you can run npx expo run:android to start the expo go app on android yourself.
you are using an expo, there is a folder named .expo-shared, after
npm install
Try to run
npm start
or
expo start
or
npx expo start
something like this will appear:
https://imgur.com/U9I7Gf4
after that go to the terminal, open the emulator in you computer and click on the terminal and press 'a',

Getting Node Module Error (Cannot find module)

I am learning the Automated tests by using selenium web driver + Javascript and node.js.
Everything is working fine when I ran that script.js from the Visual Studio code terminal(by using node main.js)
Problem
I want to schedule this script in the scheduler which automatically tests the login functionality. But when I try to run it from the task scheduler then it gives Error: Cannot find module
Does anybody know how to get rid of this.
To fix Cannot find module errors, install the modules properly by running a npm install command in the appropriate directory as your project's app. ... or delete the node_modules folder and package-lock. json file and re-install it again using the npm install command.
rm -rf node_modules package-lock.json

React native with expo: ‘react-navigation does not exist in the haste module map’

I’m a beginner working on my first app with react native and expo. I’m having trouble getting the navigation to work. When I run the app, I get the error ‘react-navigation does not exist in the haste module map’. I’ve installed react navigation through the command line and ran install npm to install dependancies.
I also had the same problems few weeks back , please follow the steps below :
Open terminal and navigate to project root directory.
write 'rm -rf node_modules' in the terminal to remove the node modules.
write 'npm install' in order to install the node modules again
write 'cd ios'.
write 'rm -r build' to clear the old build.
come back to the root folder of project again and run the project.
Your code will run smoothly.

Steps to run a react native project in android studio after eject from create react native

What are the steps to run a react native project in android studio after eject from create react native. I didn't find a helpful step by step description online for this. I am pretty new to android development, facing different problems related to gradle versions and other stuffs in android. Do I need to run it from android studio, or just need to run the command npm run android
Install React Native using Mac OS
Please check React Native Document before start.
https://facebook.github.io/react-native/docs/getting-started.html
If you don’t have install brew in your computer then must hit that command line.
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Then Follow the Command step to step
brew install node
Once Complete node step up then you must Create React Native Directory in your Computer to do this follow the Following Steps:
Open Terminal and hit…
cd
cd Documents
mkdir react-native
cd react-native/
Now You create your React Native Directory now once it’s done.
Node comes with npm, which lets you install the React Native command line interface.
Run the following command in a Terminal:
npm i react-native-cli - g
it need some time to complete install once it’s done make sure you check it’s npm version to do that hit the following command line.
npm -v
So you get your version code if you are using 4.6.1 above then maybe you are using some of the problems so remove above version and use this of a version using this command line.
npm I -g npm#4.6.1
Hit enter and you start with that npm version. So it’s Done now Follow the React Native Document if you are using Android and iOS then you can follow the Steps but skip installation node step because we set up all those steps and once you are using Setup Android or Xcode in your pc Follow the Command to run React Native app.
Using your React Native Folder that you create in a directory like this
cd
cd Documents
mkdir react-native
cd react-native/
react-native init HelloWorld
Here we are Create our HelloWorld Programme Using Android Studio and React Native.
Once you have ejected you need to run below commands
exp run
react-native run-android
Make sure exp is installed. exp run will serve the js bundle locally which will be accessed when your android app runs via react-native run-android command on simulator or connected device.

react-native not found + mac os

I am trying to run basic react-native app in my macOS. I installed node through brew .
My node version: v6.12.0
npm version :5.5.1
Then i installed reatc-native-cli using npm. Now when i try to create a project using react-native init it says react-native command not found.
I tried all solutions but no hope. as i am new bee to this react-native guide me solve this. Thanks in advance.
I tried all post including
react-native: command not found
You should install React-Native CLI first before using "react-native init".
npm install -g react-native-cli
For more information of getting started React-Native in manual, please follow this Document
https://facebook.github.io/react-native/docs/getting-started.html
And select tab Building Projects with Native Code for manual create project without Expo
Steps to install React Native CLI in Mac OS:
Run npm install -g react-native-cli
or sudo npm install -g react-native-cli
2. Once successful, get the installed path from the output:
/Users/jeemok/.npm-packages/bin/react-native -> /Users/jeemok/.npm-packages/lib/node_modules/react-native-cli/index.js
+ react-native-cli#2.0.1
added 78 packages from 28 contributors in 12.39s
In my case, my path is /Users/jeemok/.npm-packages/bin/react-native
3. Run export PATH="/Users/jeemok/.npm-packages/bin:$PATH"
4. Now you should be able to use the command react-native
Example to init a project
react-native init TodoApp
cd TodoApp
react-native run-ios
1.install
-Xcode
-Android Studio
2.
react-native init FirstApp
if hit the below error
-bash:react-native:command not found
4.
npm list -g | head -n 1
5.
/usr/local/Cellar/node/8.1.4/lib
U will found the file "react native"
6.
open .bash_profile (if .bash_profile not exist setup .bash_profile)
add the below in .bash_profile file
export PATH=”/usr/local/Cellar/node/8.1.4/bin:$PATH”
run the command to reload .bash_profile
source .bash_profile
8.create your project
react-native init FirstApp
How I solved this issue.
Call npm list -g | head -n 1
Open .bash_profile in a code editor. It should be located at ~/.bash_profile
Paste export PATH="/usr/local/Cellar/node/10.12.0/bin:${PATH}" somewhere in it. Make sure you have the correct version in there. Also make sure PATH is wrapped in { }
Save the file.
Close your terminal and reopen. You should be good now.
How I solved this not found issue. For those who are still facing the issue, I am sharing my solution.
I have setup a fresh react native project by running the following command.
npx react-native init AwesomeProject
we don't need to install
react-native-cli
If you previously installed a global react-native-cli package, please remove it as it may cause unexpected issues.
as mentioned in the original docs.
just add npx at beginning npx react native link and it worked!

Categories

Resources