Start a project - android

Occurred some errors while I was starting to make a project.
I just installed all packages. tried to create new project. it is my first time to work with react-native.
what's wrong? what should I do?
This will walk you through creating a new React Native project in /TestApp
Installing react-native...
Consider installing yarn to make this faster: https://yarnpkg.com
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: react#undefined
npm WARN node_modules/react
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react#"18.1.0" from react-native#0.70.6
npm WARN node_modules/react-native
npm WARN react-native#"*" from the root project
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: react#undefined
npm WARN node_modules/react
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react#"^16.0.0 || ^17.0.0 || ^18.0.0" from react-shallow-renderer#16.15.0
npm WARN node_modules/react-native/node_modules/react-shallow-renderer
npm WARN react-shallow-renderer#"^16.15.0" from react-native#0.70.6
npm WARN node_modules/react-native
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: react#undefined
npm WARN node_modules/react
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer react#"^16.8.0 || ^17.0.0 || ^18.0.0" from use-sync-external-store#1.2.0
npm WARN node_modules/react-native/node_modules/use-sync-external-store
npm WARN use-sync-external-store#"^1.0.0" from react-native#0.70.6
npm WARN node_modules/react-native
npm WARN ERESOLVE overriding peer dependency
npm WARN Found: #babel/preset-env#undefined
npm WARN node_modules/#babel/preset-env
npm WARN
npm WARN Could not resolve dependency:
npm WARN peer #babel/preset-env#"^7.1.6" from jscodeshift#0.13.1
npm WARN node_modules/jscodeshift
npm WARN jscodeshift#"^0.13.1" from react-native-codegen#0.70.6
npm WARN node_modules/react-native-codegen
npm ERR! code FETCH_ERROR
npm ERR! errno FETCH_ERROR
npm ERR! invalid json response body at https://registry.npmjs.org/react reason: Unexpected end of JSON input
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-11-27T19_45_05_880Z-debug.log
Error: Command failed: npm install --save --save-exact react-native
at checkExecSyncError (child_process.js:635:11)
at execSync (child_process.js:671:15)
at run (/usr/local/lib/node_modules/react-native-cli/index.js:294:5)
at createProject (/usr/local/lib/node_modules/react-native-cli/index.js:249:3)
at init (/usr/local/lib/node_modules/react-native-cli/index.js:200:5)
at Object.<anonymous> (/usr/local/lib/node_modules/react-native-cli/index.js:153:7)
at Module._compile (internal/modules/cjs/loader.js:999:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14) {
status: 1,
signal: null,
output: [ null, null, null ],
pid: 45745,
stdout: null,
stderr: null
}
Command `npm install --save --save-exact react-native` failed.
This is my OS information:
Operating System: Debian GNU/Linux 11
KDE Plasma Version: 5.20.5
KDE Frameworks Version: 5.78.0
Qt Version: 5.15.2
Kernel Version: 5.10.0-19-amd64
I install all requirments.
I need Terminal Commands what i should to do.
I would be appreciated you.

Try using expo. https://docs.expo.dev/get-started/create-a-new-app/
Expo, in my opinion, does a better job than react-native walking through new users on how to use react-native.
run npx create-expo-app my-app this will create a new app called "my-app".
Or you could run npx create-expo-app --template to begin with a starter app. I like to use 'Navigation (TypeScript)'.
The expo link will explain how to set up your app and how to run your app in a simulator or with the expo go app on your phone. It's a great resource. There is also a tutorial that explains in depth how to create, style, and build an app using react-native.
Hope that helped!

Related

¿How can i add an npm install --force when i execute ionic build android?

I execute this command
ionic capacitor sync android
But i had this conflictive modules ->
C:\Users\DELL\Documents\inspecciones\inpecciones-app>ionic capacitor sync android
> npm.cmd i -E #capacitor/android#3.1.1
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: #angular-devkit/build-angular#15.1.5
npm ERR! Found: #angular/compiler-cli#12.0.5
npm ERR! node_modules/#angular/compiler-cli
npm ERR! dev #angular/compiler-cli#"~12.0.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #angular/compiler-cli#"^15.0.0" from #angular-devkit/build-angular#15.1.5
npm ERR! node_modules/#angular-devkit/build-angular
npm ERR! dev #angular-devkit/build-angular#"^15.1.5" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: #angular/compiler-cli#15.1.4
npm ERR! node_modules/#angular/compiler-cli
npm ERR! peer #angular/compiler-cli#"^15.0.0" from #angular-devkit/build-angular#15.1.5
npm ERR! node_modules/#angular-devkit/build-angular
npm ERR! dev #angular-devkit/build-angular#"^15.1.5" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\DELL\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\DELL\AppData\Local\npm-cache\_logs\2023-02-14T21_22_36_075Z-debug-0.log
[ERROR] An error occurred while running subprocess npm.
npm.cmd i -E #capacitor/android#3.1.1 exited with exit code 1.
Re-running this command with the --verbose flag may provide more information.
So when it runs -> execute an npm i but i want to add an --force
In your package.json you can define custom scripts that can run multiple commands after each other.
Below is an Implementation that
installs npm Packages with -force flag
builds your ionic project
syncs your ionic build with your android build
opens android studio with your android project
To implement add this to your package.json:
"scripts":
{
"android": "npm i -force && ionic build && ionic capacitor sync android && ionic capacitor open android"
}
The script can be called with
npm run %script name%
So in this case:
npm run android

When I create react native project it's give me error

my node and react native version
react-native -v : 2.0.1
node -v : v16.16.0
run cmd
npx react-native init Loan --version 0.68.2
or
npx react-native init Loan
its give me error like this
C:\Users\dp312>npx react-native init Loan --version 0.68.2 npm WARN config global `--global`, `--local` are deprecated. Use `--location-global` instead.
This will walk you through creating a new React Native project in C:\Users\dp312\Loan
'yarn' is not recognized as an internal or external command,
operable program or batch file. Installing react-native#0.68.2...
Consider installing yarn to make this faster: https://yarnpkg.com
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead. npm ERR! code ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC
npm ERR! errno ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC
npm ERR! Invalid response body while trying to fetch https://registry.npmjs.org/react-native: 10976: error:1408F119:SSL routines: ss13_get_record: decryption failed or bad rec ord mac:c:\ws\deps\openssl\openssl\ssl\record\ss13_record.c:677: npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR!
C:\Users\dp312\AppData\Local\npm-cache\_logs\2023-02-01T12_48_16_254Z-debug-0.log
Error: Command failed: npm install --save --save-exact react-native#0.68.2
at checkExecSyncError (node: child_process:828:11)
at execSync (node: child_process: 899:15) at run (C:\Users\dp312\AppData\Roaming\npm\node_modules\react-native-cli\index.js:294:5)
at createProject (C:\Users\dp312\AppData\Roaming\npm\node_modules\react-native-cli\index.js:249:3)
at init (C:\Users\dp312\AppData\Roaming\npm\node_modules\react-native-cli\index.js:200:5) at Object.<anonymous> (C:\Users\dp312\AppData\Roaming\npm\node_modules\react-native-cli\index.js:153:7)
at Module._compile (node:internal/modules/cjs/loader: 1105:14)
at Object.Module._extensions..js (node: internal/modules/cjs/loader: 1159:10)
at Module.load (node:internal/modules/cjs/loader: 981:32) {
status: 1,
signal: null,
output: null, null, null ],
pid: 7772,
stdout: null,
stderr: null
} Command `npm install --save --save-exact react-native#0.68.2` failed.
C:\Users\dp312>
enter image description here
or when I try to install any lib in project with npm its give me also error but when I run yarn it's install successfully
when run yarn cmd it's working
when run npm it's give me like this error
any one can give me solution and why this error is come
I'm just reset my pc after this error is come but before reset pc it's working properly I don't know why this error is come.
Try clearing the cache and do a install again
npm cache clear --force
npm install
Or
npm cache verify
npm install
seems like a recurring problem with npm packages: npm ERR! Invalid response body while trying to fetch http://registry.npmjs.org/accepts: Integrity verification failed for sha
how can I fix this problem npm error to install my react app?

Unable to start react native app

Guys I am Stuck here I have downgrade both my node and npm in order to run the application
currently my node version is 8.4.0 and npm is 4.6.1
Steps I did are
create-react-native-app SampleApp
cd SampleApp
npm run ios
And the result app is not working
Purushothams-MacBook-Pro:SampleApp Purushotham$ npm run ios
SampleApp#0.1.0 ios /Users/Purushotham/Desktop/Demo/SampleApp
react-native-scripts ios
21:59:37: Starting packager...
21:59:39: Error starting packager: Error: EACCES: permission denied, open '/Users/Purushotham/Desktop/Demo/SampleApp/.expo/packager-info.json'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! SampleApp#0.1.0 ios: react-native-scripts ios
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the SampleApp#0.1.0 ios script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/Purushotham/.npm/_logs/2017-11-12T16_29_39_085Z-debug.log
After executing sudo chmod -R 777 ~/.expo/ and installing expo.io application in my macbook it gets stuck like thi. you can see the below picture

ionic 2: ionic run android shows error

i have error when i run "ionic run android" or "ionic build android" in my ionic 2 app
this is the error i get. i just tryinh to see my app in the emulator of android.
i tried to make new ionic 2 project but it's the same problem.
Running 'build:before' npm script before build
> ionic-hello-world# build C:\Users\Adir\MyApps\tasklist
> ionic-app-scripts build --rollup ./config/rollup.config.js
[20:16:33] ionic-app-scripts 0.0.30
[20:16:33] build prod started ...
[20:16:33] clean started ...
[20:16:33] clean finished in 24 ms
[20:16:33] copy started ...
[20:16:33] ngc started ...
[20:16:33] lint started ...
[20:16:33] copy finished in 182 ms
[20:16:34] lint finished in 770 ms
[20:16:52] ngc finished in 18.71 s
[20:16:52] bundle prod started ...
[20:16:52] bundle prod failed: Could not resolve entry (/app/main.prod.ts)
[20:16:52] Error: Could not resolve entry (/app/main.prod.ts)
at C:\Users\Adir\MyApps\tasklist\node_modules\rollup\dist\rollup.js:8635:28
at process._tickCallback (internal/process/next_tick.js:103:7)
Error running ionic app script "build": Error: Could not resolve entry (/app/main.prod.ts)
npm
ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
npm ERR! node v6.7.0
npm ERR! npm v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! ionic-hello-world# build: `ionic-app-scripts build --rollup ./config/rollup.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ionic-hello-world# build script 'ionic-app-scripts build --rollup ./config/rollup.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ionic-hello-world package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!
ionic-app-scripts build --rollup ./config/rollup.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs ionic-hello-world
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls ionic-hello-world
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Adir\MyApps\tasklist\npm-debug.log
Caught exception:
undefined
Mind letting us know? https://github.com/driftyco/ionic-cli/issues
C:\Users\Adir\MyApps\tasklist>
This has been a common issue lately with ionic and A2 and resolving main.prod.*Try updating you app scripts for the project.
npm install #ionic/app-scripts#latest
Your error message should change after that with what is actually causing your build to crash. If the error message changes please update your question with the new message.
Checkout this out as well for more information on this issue: Ionic forum
Close all ionic folders and serve or lab. And try again, ionic cordova build android.
First of all, Check the version of Android in package.json file.
Now remove platform with this command (ionic cordova platform rm android)
After that addd the platform with this command (ionic cordova platform add
android#6.4.0). Where 7.0.0 is not stable version so use 6.4.0
Now, run this command (ionic cordova run android) or in mac (sudo ionic cordova run android)
Try out below command
$ cordova clean android
$ cordova build android
$ ionic cordova build android
There is a path setup problem in your system.
1st check npm version using CMD: npm -v
If it shows version number then use below code, otherwise 1st setup your npm path, you can use gitbash cmd, nodejs cmd
Try to use
ionic cordova run android
or
ionic cordova platform remove android
ionic cordova run android
If you have MAC system must use sudo like
sudo ionic cordova run android

Ionic is Not Installing on Windows 7 - Getting Many Errors

I am getting this error while i am trying to install Ionic
$ npm install ionic cordova -g
npm ERR! not a package C:\Users\Sridhar\AppData\Roaming\npm-cache\ansi-regex\2.0.0\package.tgz
npm ERR! not a package C:\Users\Sridhar\AppData\Roaming\npm-cache\ansi-regex\2.0.0\package.tgz
npm ERR! not a package C:\Users\Sridhar\AppData\Roaming\npm-cache\ansi-regex\2.0.0\package.tgz
npm WARN engine xmlbuilder#2.2.1: wanted: {"node":"0.8.x || 0.10.x"} (current: {"node":"4.2.2","npm":"2.14.7"})
npm ERR! not a package C:\Users\Sridhar\AppData\Roaming\npm-cache\ansi-regex\2.0.0\package.tgz
npm ERR! not a package C:\Users\Sridhar\AppData\Roaming\npm-cache\ansi-regex\2.0.0\package.tgz
npm ERR! not a package C:\Users\Sridhar\AppData\Roaming\npm-cache\delayed-stream\0.0.5\package.tgz
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "ionic" "cordova" "-g"
npm ERR! node v4.2.2
npm ERR! npm v2.14.7
npm ERR! path C:\Users\Sridhar\AppData\Roaming\npm\node_modules\ionic\node_modules\npm\node_modules\read-installed
npm ERR! code UNKNOWN
npm ERR! errno -4094
npm ERR! syscall scandir
npm ERR! UNKNOWN: unknown error, scandir 'C:\Users\Sridhar\AppData\Roaming\npm\node_modules\ionic\node_modules\npm\node_modules\read-installed'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! error rolling back Error: UNKNOWN: unknown error, scandir 'C:\Users\Sridhar\AppData\Roaming\npm\node_modules\ionic\node_modules\npm\node_modules\read-installed'
npm ERR! error rolling back at Error (native)
npm ERR! error rolling back { [Error: UNKNOWN: unknown error, scandir 'C:\Users\Sridhar\AppData\Roaming\npm\node_modules\ionic\node_modules\npm\node_modules\read-installed']
npm ERR! error rolling back errno: -4094,
npm ERR! error rolling back code: 'UNKNOWN',
npm ERR! error rolling back syscall: 'scandir',
npm ERR! error rolling back path: 'C:\\Users\\Sridhar\\AppData\\Roaming\\npm\\node_modules\\ionic\\node_modules\\npm\\node_modules\\read-installed' }
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Sridhar\npm-debug.log
Please help me to install Ionic
Please follow the below steps to install ionic.
IONIC Setup
Setup Environment (Installations)
Install Node.js
a. http://nodejs.org/download/
install ionic framework
a. $ npm install -g cordova ionic
install android SDK and set environment variables
a. Set following environment variable
b. set ANDROID_HOME=C:\\android-sdk-windows
Install Android Target 19 (follow following steps)
Open the SDK Manager (typing android into the terminal, assuming it's in your file path)
Selected box next to Android 4.4.2 (API 19)
Clicked button Install 8 packages
Install ant using CMD window
npm Install -g ant
a. Add following path in environment variables (PATH):
C:\Users\user.name\AppData\Roaming\npm\node_modules\ant\ant\bin
Once you setup the ionic environment.
Create the basic application for testing.
Open node.js command prompt
ionic start myApp tabs
cd myApp
ionic serve (it will open the application in browser)
ionic platform add android (replace ios with android if you want to add iOS platform)
ionic build android (replace ios with android if you want to build in iOS platform)
ionic emulate android android (replace ios with android if you want to emulate iOS platform)
NOTE: If ERR occurs, follow below link:
installing ionic npm ERR! tar.unpack error
Have you followed the right installation sequence ?
Install or update Node.js
Download the most recent version of Node.js. If you are running an older version of Node, make sure to update it because older versions had issues with npm.
As with the other commands, nodejs should now function in cmd.exe but just to be careful, add the full path to the bin folder in Node to your PATH, which will look something like C:\Program Files\nodejs\bin
Install Cordova
Open a new cmd.exe window, and run:
$ npm install -g cordova
Install Ionic
$ npm install -g ionic
Find the official installation doc and this too for more.

Categories

Resources