I'm trying to build a React Native project from another developer and he didn't commit the ios directory. Now I need to run the app on iOS and tried to use react-native upgrade to recreate the iOS config. When I run react-native run-ios after npm install, I'm getting "Application has not been registered error".
What do I have to change or what is the right way to recreate the iOS settings?
I'm running these commands on a MacOS High Sierra with Xcode 10.
Here's the package.json:
{
"name": "thefeedback-app",
"version": "1.0.0",
"description": "Project",
"main": "app.js",
"scripts": {
"start": "react-native start",
"postinstall": "node ./android-release-gradle-fix.js",
"clean":" #powershell -NoProfile -ExecutionPolicy Unrestricted -Command ./preBuilding.ps1",
"android": "npm run clean && react-native run-android",
"ios": "react-native run-ios",
"test": "node node_modules/jest/bin/jest.js",
"bundle": "react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res"
},
"keywords": [
"react",
"native"
],
"license": "ISC",
"dependencies": {
"axios": "0.18.0",
"moment": "2.22.2",
"react": "16.4.0 ",
"react-native": "0.55.4",
"react-native-background-job": "2.1.1",
"react-native-easy-toast": "1.1.0",
"react-native-material-dropdown": "0.11.1",
"react-native-material-textfield": "0.12.0",
"react-native-onesignal": "3.2.5",
"react-native-push-notification": "3.0.2",
"react-native-sqlite-storage": "3.3.6",
"react-native-vector-icons": "4.6.0",
"react-navigation": "2.3.0",
"react-redux": "5.0.7",
"redux": "3.7.2",
"render-if": "0.1.1"
},
"devDependencies": {
"react-native-scripts": "1.14.1",
"react-test-renderer": "16.3.0-alpha.1"
}
}
The index.js:
import { AppRegistry } from 'react-native';
import App from './app/app';
import data from './app.json';
AppRegistry.registerComponent(data.displayName, () => App);
console.disableYellowBox = true;
And the app.json:
{
"expo": {
"sdkVersion": "25.0.0"
},
"name": "TheFeedbackApp",
"displayName": "TheFeedbackApp"
}
It seems that's something related to the name having a hyphen.
Related
my English is little rusty, I'm sorry for that.
I have an error at the moment when I am starting react-native project on the iOS Simulator.
To rule out any conflict with my code, I started a new project
react-native init demo
react-native start
react-native run-ios --simulator="iPhone 6"
Now is when i get the message error
Loading dependency graph, done.
error: bundling failed: Error: Unable to resolve module `warnOnce` from `node_modules/react-native/Libraries/react-native/react-native-implementation.js`: warnOnce could not be found within the project.
If you are sure the module exists, try these steps:
1. Clear watchman watches: watchman watch-del-all
2. Delete node_modules: rm -rf node_modules and run yarn install
3. Reset Metro's cache: yarn start --reset-cache
4. Remove the cache: rm -rf /tmp/metro-*
at ModuleResolver.resolveDependency (/usr/local/lib/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:186:15)
at ResolutionRequest.resolveDependency (/usr/local/lib/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:52:18)
at DependencyGraph.resolveDependency (/usr/local/lib/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph.js:282:16)
at Object.resolve (/usr/local/lib/node_modules/react-native/node_modules/metro/src/lib/transformHelpers.js:267:42)
at /usr/local/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/traverseDependencies.js:426:31
at Array.map (<anonymous>)
at resolveDependencies (/usr/local/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/traverseDependencies.js:423:18)
at /usr/local/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/traverseDependencies.js:275:33
at Generator.next (<anonymous>)
at asyncGeneratorStep (/usr/local/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/traverseDependencies.js:87:24)
I need to know if anybody have same problem and how fix it ?
My react-native version is 0.61.5
package.json
{
"name": "demo",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"react": "16.9.0",
"react-native": "0.61.4"
},
"devDependencies": {
"#babel/core": "^7.6.2",
"#babel/runtime": "^7.6.2",
"#react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^24.9.0",
"eslint": "^6.5.1",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.56.0",
"react-test-renderer": "16.9.0"
},
"jest": {
"preset": "react-native"
}
}
Thank you for advance.
I found the solution.
I was using react-native-cli.
An advice report in the last react-native documentation , inform that react-native-cli may cause unexpected issues.
I removed react-native-cli and now I'm using
npx react-native ...
Thank you and I'm sorry for my horrible English.
Try by editing the your metro.config.js to
const blacklist = require('metro-config/src/defaults/blacklist');
module.exports = {
resolver: {
blacklistRE: blacklist([
/node_modules\/.*\/node_modules\/react-native\/.*/,
])
},
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
};
Refer the thread and answer
Problem
I get the error "Cannot read property 'State' of undefined" when trying to use a stack navigator in React Navigation. Switch and bottomTabNavs are working perfectly fine.
If anyone knows how to solve this problem that would be amazing!
What I've tried
I've already checked to make sure react-native-gesture-handler is installed and linked properly.
My Package.json:
{
"name": "app",
"version": "5.1.0",
"private": true,
"devDependencies": {
"babel-jest": "23.6.0",
"fs-extra": "^6.0.1",
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.49.2",
"react-test-renderer": "16.7.0",
"reactotron-react-native": "^3.2.0",
"replace-in-file": "^3.4.2"
},
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios --simulator=\"iPhone X\"",
"apk": "cd android && ./gradlew assembleRelease",
"rename": "node ./bin/rename.js",
"start": "react-native start",
"test": "jest"
},
"jest": {
"preset": "react-native"
},
"dependencies": {
"axios": "^0.18.0",
"lodash": "^4.17.11",
"react": "16.6.3",
"react-native": "0.58.0-rc.2",
"react-native-firebase": "^5.2.0",
"react-native-gesture-handler": "^1.1.0",
"react-native-rate": "^1.1.6",
"react-native-sensitive-info": "5.2.9",
"react-native-splash-screen": "^3.2.0",
"react-native-status-bar-height": "^2.3.1",
"react-native-table-component": "^1.2.0",
"react-navigation": "^3.3.2"
}
}
The issue was that the pod file was not installed even though react-native link indicated the package was successfully linked.
To solve the issue follow these steps:
cd ios
Pod install
Clean ios folder
Run application
well i am not getting any answers to this error ..
npm update to latest and downgrade also tried.
nothing works
package.json so it i get some help ...
{
"name": "kelsnew",
"version": "0.1.0",
"private": true,
"devDependencies": {
"jest-expo": "~27.0.0",
"react-native-scripts": "^1.14.1",
"react-test-renderer": "16.3.1"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "jest"
},
"dependencies": {
"expo": "^28.0.0",
"jest": "^23.4.1",
"react": "16.3.1",
"react-native": "^0.56.0"
}
}
I tried several things and several things in combination, but ultimately when I added #babel to my .babelrc plugin line without any other changes. I then deleted node_modules, package-lock.json and ran npm install.
{
"presets": ["babel-preset-expo"],
"env": {
"development": {
"plugins": ["#babel/transform-react-jsx-source"]
}
}
}
I also upgraded from Nodejs 8 to 10 along the way (and stayed there). I don't think it material, but I mention it just in case, check your node --version.
Check your app.js for any calls to the property filename such as someObject.filename, this is most likely due to some object not being instantiated and thus you are getting undefined.filename which throws an error.
I have some problems when i try to run my app on phones that have iOS, but in Android don't have this problem. I'm coding in Sublime Text, not in XDE and executing my project in terminal, with commands npm start and reading the QR Code. I'm coding in Windows 10.
I build the project with create-react-native-app
The erro that appears is
C:/Users/adria/Desktop/App/src/Imgs/image.png: Cannot find module
'C:/Users/adria/Desktop/App/node_moduless/expo/tools/hashAssetFiles'
In the first time i did think that image is with wrong name or wrong directory, and i go to the code and certify that is correctly. So, i resolve to try in my Android and for my surprise, work correctly.`
My project:
[https://snack.expo.io/HyKP1hyjz][1]
My package.json
{
"name": "App",
"version": "0.1.0",
"private": true,
"devDependencies": {
"react-native-scripts": "1.11.1",
"jest-expo": "25.0.0",
"react-test-renderer": "16.2.0"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "node node_modules/jest/bin/jest.js" },
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"expo": "^25.0.0",
"react": "16.2.0",
"react-native": "0.52.0",
"react-navigation": "^1.5.8"
}
}
I try to remove the image from my project and try run again, and have the same problem but with another image, from react-navigation
C:\Users\adria\Desktop\App\node_modules\react-navigation\src\views\assets\back-icon.png
You'll need to have the exponent package installed, see: https://github.com/expo/expo/issues/72
Issue Description
The log of error when build project looks like below.
node /Users/niyao/Company/Projects/EVE/EVERN/node_modules/react-native/local-cli/cli.js bundle --entry-file index.ios.js --platform ios --dev false --reset-cache --bundle-output /Users/niyao/Library/Developer/Xcode/DerivedData/EVE-bzggtbnrxixkvwgqyewmpxepvljo/Build/Products/Release-iphonesimulator/EVE.app/main.jsbundle --assets-dest /Users/niyao/Library/Developer/Xcode/DerivedData/EVE-bzggtbnrxixkvwgqyewmpxepvljo/Build/Products/Release-iphonesimulator/EVE.app
fs.js:584
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
Error: ENOENT: no such file or directory, open 'package.json'
Error Scenario
After I use package.json as below to npm instal new version, the error happens within release deployment scheme.
{
"name": "NYProject",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"lint": "./node_modules/eslint/bin/eslint.js index.ios.js index.android.js react/",
"watch": "npm-watch"
},
"watch": {
"lint": {
"patterns": [
"react",
"index.ios.js",
"index.android.js"
],
"extensions": "js",
"ignore": ".node_modules",
"quiet": false
}
},
"dependencies": {
"react": "15.3.1",
"react-native": "^0.32.0",
"react-redux": "^4.4.5",
"redux": "^3.5.2",
"redux-logger": "^2.6.1",
"redux-thunk": "^2.1.0"
},
"devDependencies": {
"babel-eslint": "^6.1.2",
"eslint": "^3.3.1",
"eslint-plugin-react": "^6.1.2",
"eslint-plugin-react-native": "^2.0.0",
"npm-watch": "^0.1.6"
}
}
The shell runs failed when build project within Release build configuration.
"./NYProject/node_modules/react-native/packager/react-native-xcode.sh"
Expected Results
Xcode could run shell when build the project. Before I upgrade the package.json configuration, it did run successfully.
Additional Information
React Native version:
react-native-cli: 0.2.0
react-native: 0.32.0
Platform(s) (iOS, Android, or both?):
Xcode 7.3.1 iOS
Operating System (macOS, Linux, or Windows?):
OS X 10.11
I had the same issue, and for me, simply upgrading to react-native 0.33.0 solved the problem.