React Native project creating not working - javascript

Facing problem of creating project in React Native (iOS ). i have installed the following commands successfully:
1. /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2. npm install -g react-native-cli
3. brew install node
4. brew install watchman
5. brew install flow
When i run the command "react-native init AwesomeProject" , it shows following error;
-bash: react-native: command not found
FYI : In my mac home directory, it just create a file name "npm-debug.log".
I can't proceed on.
How i can create and run a project ?
My directory is:

Related

npx create-react-app dependencies not working

When creating a new react app via npx create-react-app client, the application is created however the react-scripts command is not found and cannot run the start script. Is there anyway to fix this? [
Question 2 Also when running application node <direct path to react-scripts start file> I cannot use the dotenv module as pollyfill is no longer supported for the fs and os modules? Any solutions?
I am using
npm version: 8.19.2
node version: v16.17.0
this problem's have multiple problems , maybe you have to create app at desktop or at C disk (if Windows) , try this
rm -rf node_modules
rm -rf package-lock.json
npm install
change node version vie NVM (optional)
Second question check this dotenv-webpack

I am trying to install react-native but keep getting errors

I want to start developing native apps with react-native and i am also using VScode as my code editor, i keep running in to error when trying to start my project using this command "expo init First project", so how do you think i can overcome this error
You should first install the expo-cli with npm install --global expo-cli before starting a project
Once you have Node.js installed run the following command:
npm install -g expo-cli
After successfully installing the Expo CLI you can initialize a brand new project by running the following command:
expo init <name of project goes here>
cd <name of project goes here>
npm start
Below is an example of how this will work:
expo init my-todo-app
cd my-todo-app
npm start

Can I install react native Cli through terminal globally?

I want to install react-native cli but I don't where to run this command: npm install -g react-native-cli. Do I need to run this command on my macOS terminal or when I will make a directory for my react native app then there I need to run this command in vscode?
Is there any issue if I run this command in my terminal or If I run this in VScode?
React Native is distributed as two npm packages, react-native-cli and react-native.
The first one is a lightweight package that should be installed globally (npm install -g react-native-cli), while the second one contains the actual React Native framework code and is installed locally into your project when you run react-native init.
Because react-native init calls npm install react-native, simply linking your local GitHub clone into npm is not enough to test local changes.
npm install –g react-native-cli
· This line installs the npm package react-native-cli along with its dependencies(from the npm repository host) inside the globally shared node_modules folder.
· Global install (with -g): puts stuff in /usr/local or wherever node is installed. This will also allow you to access the module from the command-line, as the bin is symlinked into a PATH folder (usually usr/local/bin).
Refer below link
https://rlogicaltech.medium.com/how-to-install-react-native-on-mac-step-by-step-guide-1ac822aedd4f
You can run the command anywhere in the terminal.
It will install the react-native-cli globally as we are specifying the "-g" option in the command.
Use this
npm install -g expo-cli
this how I solved it.
npm install -save react-native#latest

How to properly install test-ai-classifier plugin using appium for ui selectors?

The problem encountered was on ubuntu 20.04.
Followed the instruction from https://github.com/testdotai/appium-classifier-plugin
I did install the test-ai-classifier under the appium path and as well globally using npm install -g test-ai-classifier
I made sure that appium-doctor did not give me any error by running from the command line appium-doctor. I went to the appium path and did the following from command line:
node
require('test-ai-classifier');
Always got the same error:
Thrown:
Error: Cannot find module 'test-ai-classifier'
Require stack:
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:797:15)
at Function.Module._load (internal/modules/cjs/loader.js:690:27)
at Module.require (internal/modules/cjs/loader.js:852:19)
at require (internal/modules/cjs/helpers.js:74:18) { code: 'MODULE_NOT_FOUND', requireStack: [ '' ]
Has anyone of you encountered this issue? If yes, how did you solve it? Which environment did you use? Did you install test-ai-classifier globally or within the appium's path?
Environment:
Windows 10
Tensorflow=1.1.0
python=2.7
global modules path = C:\Users\natha\AppData\Roaming\npm
appium = 1.19.1
node = 14.15.0
npm=6.14.9
test-ai-classifies=2.1.1
Pre-requisites;
Install Android SDK and configure ANDROID_HOME
Install Java SDK and configure JAVA_HOME
Appium installation steps:
npm install -g appium --drivers=xuitest,uiautomator2
npm install -g wd
appium -a 127.0.0.1 -p 4723
npm install -g appium-doctor
appium-doctor
(appium 1.19.1 is installed)
test-ai-classifier installation - globally:
npm install -g node-pre-gyp#0.11.0
npm install --unsafe-perm --verbose -g node-sass
npm install -g node-gyp --unsafe-perm=true
//NODE_GYP_FORCE_PYTHON=python
//NODE_GYP_FORCE_PYTHON=python2
npm install -g test-ai-classifier#2.1.1 --unsafe-perm=true --build-from-source --python=python2.7
test-ai-classifier installation - in appium path:
where appium
C:\Users\natha\AppData\Roaming\npm\appium
cd C:\Users\natha\AppData\Roaming\npm\node_modules\appium\
npm install node-pre-gyp#0.11.0
npm install --unsafe-perm --verbose node-sass
npm install node-gyp --unsafe-perm=true
npm install #tensorflow/tfjs-node#1.2.3
npm install test-ai-classifier#2.1.1
Global node modules configuration:
Where does npm install packages?
If you want to change the global modules path,
use npm config edit and put prefix = /my/npm/global/modules/prefix in the file
change from
; prefix=C:\Program Files\nodejs
to
; prefix=C:\Users\natha\AppData\Roaming\npm
How to validate test-ai-classifier installation?
[https://github.com/cloudgrey-io/appiumpro/issues/9][2]
If you go into the place where appium is installed, and run node, you'll get an interactive node.js prompt. From there, run require("test-ai-classifier");
If you get an error, it means the classifier module is not correctly installed and accessible to appium.
If not, it means everything is good, just make sure you restarted the appium server after installing it.
Create a java class in InteeliJ and add the following code:
package com.example.appium;
import io.appium.java_client.MobileBy;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.testng.annotations.Test;
import io.appium.java_client.android.AndroidDriver;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.concurrent.TimeUnit;
public class TestAppiumAI {
private static AndroidDriver driver;
#Test
public void installTest() throws MalformedURLException, InterruptedException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "MotoG");
capabilities.setCapability("platformVersion", "7.1.1");
capabilities.setCapability("platformName","Android");
capabilities.setCapability("udid", "ZH33L2Z6KL");
capabilities.setCapability("automationName", "UiAutomator2");
capabilities.setCapability("skipServerInstallation", "true");
capabilities.setCapability("autoGrantPermissions", "true");
capabilities.setCapability("noReset", "false");
capabilities.setCapability("appPackage", "com.android.settings");
capabilities.setCapability("appActivity","com.android.settings.Settings");
HashMap<String, String> customFindModules = new HashMap<String, String>();
customFindModules.put("ai", "test-ai-classifier");
capabilities.setCapability("customFindModules", customFindModules);
capabilities.setCapability("shouldUseCompactResponses", false);
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
//driver.findElement(MobileBy.custom("ai:search")).click();
driver.findElement(MobileBy.custom("ai:bluetooth")).click();
driver.quit();
}
}
Create TestNG.xml as given below:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Regression" thread-count="2" parallel="tests" preserve-order="true" verbose="2">
<test name="Real Device1">
<classes>
<class name="com.example.appium.TestAppiumAI"/>
</classes>
</test>
</suite>
Start Appium server from command line:
appium -a 127.0.0.1 -p 4723
Right click TestNG.xml, and execute.
Observe Bluetooth under Settings app is getting selected.
Please feel free to take the source code/project from
[https://github.com/anbunathan/appium-examples/blob/master/Template1/src/test/java/com/example/appium/TestAppiumAI.java][2]
Also, I have added a video:
https://youtu.be/CFDSejLJEQY
In my case I used python and work on Ubuntu 20.04.
There is also an answer from Anbunathan for those who use or love java and work on Windows
Pre-requisites:
Install Android SDK and configure ANDROID_HOME
Install Java SDK and configure JAVA_HOME
Environment:
Ubuntu 20.04,
Tensorflow=2.3.1,
Tensorflow-estimator=2.3.0,
Tensorflow-gpu=2.2.0,
python=2.7.18,
appium = 1.19.1,
node = 12.14.0,
npm=6.13.4,
test-ai-classifier=1.0.0
Put the following at the end of your bashrc
#Nodejs
VERSION=v12.14.0
DISTRO=linux-x64
export PATH=/usr/local/lib/node-$VERSION-$DISTRO/bin:$PATH
Appium installation steps(I did not install appium globally):
On the command line, in your home directory, create a directory for global installations: mkdir ~/.npm-global
Configure npm to use the new directory path: npm config set prefix '~/.npm-global'
In your prefer text editor, open or create a /.profile file and add this line to it: export PATH=/.npm-globa/bin:$PATH
On the command line, update your system variables: source ~/.profile
To test your new configuration, install a package globally without using sudo: npm install -g jshint
Instead of steps 2-4, you can use the corresponding ENV variable (e.g. if you don't want to modify ~/.profile): NPM_CONFIG_PREFIX=/home/user/.npm-global
npm install appium
npm install wd --> in the command line start appium
npm install appium-doctor --> in the command line start appium-doctor
Do not forget to set the path of appium in your bashrc (export NODE_PATH=~/.npm-global/lib/node_modules/appium:$PATH)
If you want to do it globally just do the following:
npm install -g appium --drivers=xuitest,uiautomator2
npm install -g wd --> in the command line start appium
npm install -g appium-doctor --> in the command line start appium-doctor
test-ai-classifier installation - in appium path:
go to cd ~/.npm-global/lib/node_modules/appium
npm install test-ai-classifier#1.0.0
You might want to install this if you ever face some problems:
npm install node-pre-gyp#0.11.0
npm install --unsafe-perm --verbose node-sass
npm install node-gyp --unsafe-perm=true
npm install #tensorflow/tfjs-node#1.2.3
In order to make sure that test-ai-classifier is installed do the following:
Go to your command line
cd ~/.npm-global/lib/node_modules/appium
Enter node
Enter require('test-ai-classifier');
If you get an error, it means the classifier module is not correctly installed and accessible to appium.
If not, it means everything is good, just make sure you restarted the appium server after installing it.
Create your python class using your favorite IDE (Android Studio in my case).
Go to your command line and start appium(appium -a 127.0.0.1 -p 4723).
Check as well if appium-doctor does not show any error. Start it from where you installed it.
Connect your device or start your simulator from your IDE.
Go to command line and start your python script. In my case I used python3 for the shebang but working with python 2.7.
Please feel free to take a look at the source code project located here:
https://github.com/ericnana/appium_classifier_ai_python

Any idea why adonis migration command not working?

Adonis command neither give error nor works
I just clone the Node project from one PC to another. Installed npm and adonis. Now my Node project is working when I open the URL at which it is serving it shows me the login page.
When in try to execute the Migration command, cli is neither executing the command nor giving any error.
Try to reinstall #adonisjs/cli :
Uninstall (Globally):
> npm uninstall -g #adonisjs/cli
Install (Globally):
> npm i -g #adonisjs/cli
#adonisjs/cli must be installed globally (it's not a project dependency)
Installation - AdonisJS documentation

Categories