Native-starter-kit won't run properly - android

I'm talking about this starter kit here
What I have done:
Clone the repo to a local folder
cd into the folder, run npm install
Run react-native link
Run react-native run-android
Run react-native run-android again
What I got:
Error from React Packager
Looking for JS files in
D:\Projects\ReactNative\native-starter-kit
Loading dependency graph...
React packager ready.
Loading dependency graph, done.
Bundling `index.android.js` 100.0% (974/974), done.
ERROR EPERM: operation not permitted, lstat 'D:\Projects\ReactNative\native-starter-kit\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml'
{"errno":-4048,"code":"EPERM","syscall":"lstat","path":"D:\\Projects\\ReactNative\\native-starter-kit\\android\\app\\build\\intermediates\\incremental\\mergeDebugResources\\merged.dir\\values\\values.xml"}
Error: EPERM: operation not permitted, lstat 'D:\Projects\ReactNative\native-starter-kit\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml'
at Error (native)
See http://facebook.github.io/react-native/docs/troubleshooting.html
for common problems and solutions.
Press any key to continue . . .
I can't get the sample project deployed properly on my device. Notice that I run react-native run-android twice.
The first time, the bundling finished, but my device only show white background with nothing whatsoever. Then I try to run it again.
The second, the react packager got an error.
Any idea about this?

Change directory to Android folder of your project:
cd /path/to/project/android
gradlew clean
react-native run-android again.

Related

React Native response error 500

enter image description here]1
I am doing following step to start react application
react-native init reactTutorialApp
react-native run-android
by followed these steps and it is installing on Device successfully. but i am getting a following error.
The development server return response error code:500
PFA
I think you forgot to run one command, the one to start the development server.
Try:
react-native init reactTutorialApp
run the following command in the project root folder, but in another tab (this process need to be running when you're developing:
react-native start
And now you can run: react-native run-android
Tell me if it solve your problem.

React native build failed: The development server returned response error code 500

enter image description here
Browser's console Error:
Bundling index.android.js [development, non-minified, hmr disabled] 99.3% (1074/1078), failed.
Error: Uncaught error in the transformer worker: /home/manish/donut/node_modules/metro-bundler/src/transformer.js
at _transform.then.catch.error (/home/manish/donut/node_modules/metro-bundler/src/JSTransformer/index.js:172:31)
at process._tickCallback (internal/process/next_tick.js:109:7)
Make sure you have run the npm server. From your project root folder
Open terminal cd project root and run the following command
npm start
And if you are using command to compile and run the app on device or simulator, then make sure you have run the
react-native run-android or run-ios
command from different terminal, to make sure you have not closed terminal which you run npm start.
And see whether server started successfully
This can happen if import is not proper. Example if I try to import something like this below
import renderIf from './renderIf';
and there is renderIf file present in my project.
So all these types of issues will get printed in npm server logs. See the logs and fix it accordingly.

Adding a Package breaks the Build

I created a React Native App. I have Android SDK 23 installed as prescribed, ran react-native init myapp then react-native start and react-native run-android.
Everything works perfect.
Now I wanted to add a Module: https://github.com/react-native-community/react-native-linear-gradient
I did as it is described there. npm install react-native-linear-gradient --save and then react-native link. When I now want to run react-native start and react-native run-android I get:
ERROR EPERM: operation not permitted, lstat
'C:\Users\User\Documents\myapp\android\app\build\generated\source\r\debug\android\support\v7'
{"errno":-4048,"code":"EPERM","syscall":"lstat","path":"C:\\Users\\User\\Documents\\myapp\\android\\app\\build\\generated\\source\\r\\debug\\android\\support\\v7"}
Error: EPERM: operation not permitted, lstat 'C:\Users\User\Documents\myapp\android\app\build\generated\source\r\debug\android\support\v7'
I have also tried the manual way but again the same mistake. I have my terminal run as administrator so I don't know why he can't delete the path..

Android React - Getting "Requiring unknown module react"

I keep getting this error when running the app on mobile android device, can anyone help.
The actual error:
Error: Requiring unknown module "react". If you are sure the module is there, try restarting the package or running "npm install". (index.android.bundle:93)
This is a pretty common error when developing React Native apps
Standing in the project root fgrep -rlo "React" . | grep -v "node_modules" will give you all places where "React" is being called
If this doesn't help you find your issue, there are lots of things you can try but you will have to provide more code
Hope this helps
Try deleting the node_modules folder and run npm install in command line at project root directory.
If it still fails, try to run npm install react --save

react native run hello world

I am using this tutorial
https://facebook.github.io/react-native/docs/getting-started.html#content
I am using windows 8.
I have print npm install -g react-native-cli. Then
react-native init AwesomeProject
cd AwesomeProject
Then I have read that on windows I can't use this command react-native run-android so I print node node_modules/react-native/packager/packager.js
as suggested here https://facebook.github.io/react-native/docs/linux-windows-support.html#content
And I get the following output:
Error: Cannot find module
'C:\Windows\System32\AwesomeProject\node_modules\react
-native\packager\packager.js'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Function.Module.runMain (module.js:457:10)
at startup (node.js:136:18)
at node.js:972:3
Myawesomeproject folder has 2 files
npm-debug.log and package.json
So I feel like something went wrong. Ho can I fix this?
It seems like npm is not installed correctly on your machine. You may test it by calling npm install in the generated directory. If it runs successfully and the node_modules folder in that directory is filled your are good to go. You should then run the react-native init command again so it can generate everything correctly.

Categories

Resources