React-Native brand new project issues - react-native

While creating new react-native project using the cli react-native init the project gets created successfully but when running it with cli react-native run-android it started giving following error.
Error
Here is the package.json file for the newly created project.
{
"name": "TempApp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.4.1",
"react-native": "0.56.0"
},
"devDependencies": {
"babel-jest": "23.4.2",
"babel-preset-react-native": "5",
"jest": "23.5.0",
"react-test-renderer": "16.4.1"
},
"jest": {
"preset": "react-native"
}
}
after a long hurdle, I just replaced a package.json file from one of my old project to the new one then the new project is started running with the cli.
here is my new package.json
{
"name": "TempApp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.3.1",
"react-native": "0.55.4",
"react-native-checkbox": "^2.0.0",
"react-native-popup-menu": "^0.13.1",
"react-native-shared-preferences": "^1.0.0"
},
"devDependencies": {
"babel-jest": "22.4.3",
"babel-preset-react-native": "4.0.0",
"jest": "22.4.3",
"react-test-renderer": "16.3.1"
},
"jest": {
"preset": "react-native"
}
}
if you compare these json file, you can say that the project is running with slightly older version of react-native.
My question here is, is there any stable version recommendation from react-native ?

Related

Upgrading RN project from 0.46.4 to 0.60.0 and run in VSCode result Can't get fulfillment value from any promise, all promises were rejected

Just upgraded my react-native project from version 0.46.4 to 0.60.0 using yarn or npm and run with visual studio code result following error.
[Error] Error: Can't get fulfillment value from any promise, all promises were rejected.
This is my old package.json:
{
"name": "ShoppingApp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"native-base": "2.2.1",
"react": "16.0.0-alpha.12",
"react-native": "0.46.4",
"react-native-grid-view": "https://github.com/lucholaf/react-native-grid-view.git",
"react-native-scalable-image": "https://github.com/ihor/react-native-scalable-image.git",
"react-native-tabbar-bottom": "^1.0.4",
"react-native-numeric-input": "^1.8.0",
"react-navigation": "https://github.com/Maxeh/react-navigation.git",
"rn-viewpager": "https://github.com/zbtang/React-Native-ViewPager.git"
},
"devDependencies": {
"babel-jest": "21.0.0",
"babel-preset-react-native": "3.0.2",
"jest": "21.0.1",
"react-test-renderer": "16.0.0-alpha.12"
},
"jest": {
"preset": "react-native"
}
}
And my new package.json here
{
"name": "ShoppingApp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"native-base": "^2.12.1",
"react": "^16.8.6",
"react-native": "^0.60.0",
"react-native-grid-view": "^0.4.1",
"react-native-i18n": "^2.0.15",
"react-native-numeric-input": "^1.8.0",
"react-native-scalable-image": "^0.5.1",
"react-native-tabbar-bottom": "^1.0.4",
"react-navigation": "^3.11.0",
"rn-viewpager": "^1.2.9"
},
"devDependencies": {
"babel-jest": "21.0.0",
"babel-preset-react-native": "3.0.2",
"jest": "21.0.1",
"react-test-renderer": "16.0.0-alpha.12"
},
"jest": {
"preset": "react-native"
}
}
When I build my project with Visual Studio Code, show following error.
[Error] Error: Can't get fulfillment value from any promise, all promises were rejected.
Please let me upgrade my project and build it.
I found way to upgrade.
I changed dependencies carefully like following package.json.
{
"name": "ShoppingApp",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "^16.8.6",
"react-native": "^0.60.0",
"react-native-grid-view": "https://github.com/lucholaf/react-native-grid-view.git",
"react-native-numeric-input": "^1.8.0",
"react-native-scalable-image": "https://github.com/ihor/react-native-scalable-image.git",
"react-native-tabbar-bottom": "^1.0.4",
"react-native-vector-icons": "^6.6.0",
"react-navigation": "https://github.com/Maxeh/react-navigation.git",
"rn-viewpager": "https://github.com/zbtang/React-Native-ViewPager.git"
},
"devDependencies": {
"#babel/core": "^7.5.0",
"#babel/runtime": "^7.5.2",
"#react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^24.8.0",
"eslint": "^6.0.1",
"jest": "^24.8.0",
"metro-react-native-babel-preset": "^0.55.0",
"react-test-renderer": "^16.8.6"
},
"jest": {
"preset": "react-native"
}
}
As you can see I removed native-base and updated dev dependencies and add babel/core.
And delete node_modules, yarn or npm again.

Error while building React-Native application

How the issue appeared ?
1 - I started a new blank react-native project using react-native init projectName
2 - I moved screens and components from exiting project to the new one
3 - I installed the required npm modules that's I use inside the project (including expo) npm install --save expo
that's the error which I got "check the below image" , however I installed expo
that's my package.json file
{
"name": "taplot",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"axios": "^0.18.0",
"expo": "^29.0.0",
"native-base": "^2.7.2",
"react": "16.4.1",
"react-native": "0.56.0",
"react-native-easy-grid": "^0.2.0",
"react-native-flags": "^1.0.0",
"react-native-icon-badge": "^1.1.3",
"react-native-public-ip": "^1.0.0",
"react-native-toaster": "^1.2.2",
"react-navigation": "^2.9.3"
},
"devDependencies": {
"babel-jest": "23.4.2",
"babel-preset-react-native": "5.0.2",
"jest": "23.4.2",
"react-test-renderer": "16.4.1"
},
"jest": {
"preset": "react-native"
}
}

The development server returned error code: 500

I'm trying to run an android project on the android studio emulator and every time I'm getting this error message can anyone help please? I linked an image above
package.json :
{
"name": "AwesomeProjec",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"react": "16.4.1",
"react-native": "^0.55.4"
},
"devDependencies": {
"babel-core": "^6.26.3",
"babel-jest": "23.4.2",
"babel-loader": "^7.1.5",
"babel-preset-react-native": "5",
"gulp-babel": "^7.0.1",
"jest": "23.4.2",
"react-test-renderer": "16.4.1"
},
"jest": {
"preset": "react-native"
}
}
Try to create the project with below command:-
react-native init ProjectName --version react-native#0.55.0

Unhandled JS Exception: Requiring unknown module "12"

The problem comes soon after react-native init tech_stack1, react-native run-iso command and the last Xcode update (9.1).
It alternate with "No bundle URL present".
This my package.json
"name": "tech_stack1",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.0.0",
"react-native": "0.50.0"
},
"devDependencies": {
"babel-jest": "21.2.0",
"babel-preset-react-native": "4.0.0",
"jest": "21.2.1",
"react-test-renderer": "16.0.0"
},
"jest": {
"preset": "react-native"
}
After some upgrades to #latest versions of react-native, redux and react-redux I was able to get rid of this error, also by performing a react-native start command in a new terminal window ( to get rid of no bundle URL present).

React native TCP guide issue. "Object prototype may only be an Object or null." when doing var net = require('net');

I am following this guide on using tcp sockets in react native. I followed all the steps but when I run I get this error.
The problem is with this line:
var net = require('net');
This is my package.json
{
"name": "MyTCP",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest",
"postinstall": "rn-nodeify --install stream,process,util --hack"
},
"dependencies": {
"process": "^0.11.0",
"react": "15.4.2",
"react-native": "0.41.1",
"react-native-tcp": "^3.2.0",
"readable-stream": "^1.0.33",
"stream-browserify": "^1.0.0"
},
"devDependencies": {
"babel-jest": "18.0.0",
"babel-preset-react-native": "1.9.1",
"jest": "18.1.0",
"react-test-renderer": "15.4.2",
"rn-nodeify": "^7.0.1"
},
"jest": {
"preset": "react-native"
},
"react-native": {
"net": "react-native-tcp",
"_stream_transform": "readable-stream/transform",
"_stream_readable": "readable-stream/readable",
"_stream_writable": "readable-stream/writable",
"_stream_duplex": "readable-stream/duplex",
"_stream_passthrough": "readable-stream/passthrough",
"stream": "stream-browserify"
},
"browser": {
"net": "react-native-tcp",
"_stream_transform": "readable-stream/transform",
"_stream_readable": "readable-stream/readable",
"_stream_writable": "readable-stream/writable",
"_stream_duplex": "readable-stream/duplex",
"_stream_passthrough": "readable-stream/passthrough",
"stream": "stream-browserify"
}
}
I'm running on Windows 10 on an android device.