When I run the react native project with react-native run-ios.It shows the following error on my iOS simulator.On my android simulator, it is totally ok.I have deleted node module and reinstalled.But the error is still there.I don't want to entirely delete my ios/build folder since I have manually added library dependencies in there and that third party libraries were working properly in my react native project.Can someone help me with this?
Error Message
Requiring unknown module "11".If you are sure the module is there, try
restarting Metro Bundler.You may also want to run yarn or npm install(
depending on your environment ).
package.json
{
"name": "AwwsomeProject",
"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-navigation": "^1.1.473",
"react-native-vector-icons": "^4.6.0"
},
"devDependencies": {
"babel-jest": "23.2.0",
"babel-preset-react-native": "4.0.0",
"jest": "23.2.0",
"react-test-renderer": "16.3.1"
},
"jest": {
"preset": "react-native"
}
}
Restarting packager fixed my issue.
I fixed the issue with the instructions from the following page:
https://facebook.github.io/react-native/docs/troubleshooting#content
Basically it asks you to terminate the processes running on a specific port.
Run the following command to find the id for the process that is listening on port 8081:
$ sudo lsof -i :8081
Then run the following to terminate the process:
$ kill -9 <PID>
I just killed all node processes
killall node
🙌 and launched again
I had the same problem. Running npm install or yarn install should fix the issue.
I had the same problem while working with my react native app and expo. Same screen with 'Requiring Unknown Module 1".
This is how I fixed it:
I closed Expo
I closed the Metro bundler on my local host
I closed the packager on my terminal with Ctlr + C
I restarted with npm start
I relaunched the project on Expo.
It worked for me.
I had this issue on Android (React-Native-CLI).
Terminating the application and restarting metro server absolutely solved the issue.
yarn react-native start
Using yarn, I did the following (for Android emulation):
From root directory in your project:
cd android
./gradlew clean
cd ..
yarn start --reset-cache
yarn android
Looks like node and the application inside simulator hangs sometimes. I encountered this several times on macOS / iOS.
yarn install did not help.
restarting simulation with expo run:ios / yarn start / yarn ios did not help.
What helped was killall node and killall <your_mobile_app_name>.
npm run ios fixed for me after npm start
Related
I'm following this tutorial:
https://blog.expo.io/building-a-react-native-app-using-expo-and-typescript-part-1-a81b6970bb82
yarn global add create-react-native-app
create-react-native-app my-app-name
cd my-app-name
yarn start
I am on the same network as my phone (Android). No VPN. I am in the root folder of my app. It says Loading dependency graph, done. so I know it's running.
Firewall is also off for this as well and this is not a timeout error.
When I scan the QR code:
Something went wrong. Could not load exp://10.0.0.21:19000.
What could be my issue?
EDIT
New error: Uncaught Error: java.net.ConnectException: Failed to connect to /10.0.0.21.19000
Try opening the debugger in chrome and then select tunnel if your device and the development pc are not connected to the same server.
Try the Enter URL manually option
First make sure you are on the same wifi ( computer || laptop and mobile device)
Second open cmd and run command ipconfig their you will get IPv4 Address copy it
Go to your expo go app tap on Enter URL manually
Enter exp://your_IPv4_Address:19000 ( Example -- exp://192.168.1.38:19000 )
Connect now -- It should work
In my case, I used tunnel and there was a problem with the sdk version - I have 39.0.0 and I should use only 36, 37 or 38 - that is the message that i have got from expo, so all I did is to get into the app.json file, and add the following line in expo (or just change it if it already exist):
"sdkVersion": "38.0.0"
and it should look like:
"expo": {
"name": "DoneWithIt",
"slug": "DoneWithIt",
"sdkVersion": "38.0.0",
"version": "1.0.0",
....
....
}
In the package.json file in dependencies, change the version to 38.0.0 in "expo" and "react-native" :
"dependencies": {
"expo": "~38.0.0",
"expo-status-bar": "~1.0.2",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-
38.0.0.tar.gz",
"react-native-web": "~0.13.12"
}
then run:
cd yourAppName
npm start
and it will be loaded on your phone.
you can watch it from here:
https://www.youtube.com/watch?v=eS8VULijAZ4
In this video he uses 32.0.0 so be aware to the updated version (in my case 38.0.0 was good for 09/2020)
Just delete the node_modules folder from your application and then run npm install to get the dependencies.
Now run expo start or npm start, the QR code will load now.
On node v12.18. In the package.json downgrade expo and react-native connector. 38 works instead of 40.
"expo": "~38.0.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-38.0.0.tar.gz",
Then remove node_modules and reinstall them
rm -rf node_modules
npm install
then run again :
npm start
QR should work this time
I had this problem after and expo update. Instead of running
npm/yarn start
(executes expo start --dev-client)
Try
npm run run
(executes expo start)
run the command
expo start --tunnel
I am developing a React Native app. My code is error free, but it is facing build problems. I get an error in the Metro Bundler when I execute the command react-native run-android. The error says:
UnhandledPromiseRejectionWarning: Failed to start watch mode.
I also tried adding Watchman to node_modules using the command $yarn add watchman.
I get a prompt that it is deprecated.
How should I solve the error?
My package.json contains the following:
"dependencies": {
"expo": "^25.0.0",
"native-base": "^2.3.7",
"react": "16.2.0",
"react-native": "0.52.0",
"react-native-vector-icons": "^4.5.0",
"react-navigation": "^1.0.0-beta.27",
"watchman": "^1.0.0"
}
"devDependencies": {
"babel-jest": "22.1.0",
"babel-preset-react-native": "4.0.0",
"jest": "22.1.3",
"react-test-renderer": "16.2.0"
}
To have watchman in windows do the following:
(1)Download watchman zip file from the link here
(2) Unzip the folder
(3) Place the watchman.exe file in the folder that is registered in the PATH (environment variable) (Eg: Place the watchman.exe file in C:/ProgramFiles/ and make sure the PATH = 'C:/ProgramFiles')
Done! You would never face this error again!
I have also faced the same issue.Then I have
Deleted the node modules and installed them again by using npm install.
Then clean gradle by '.\gradlew'
Then run the app by 'npx react-native run-android'.
The above steps helped me to resolve the error.
You have to install watchman using brew:
brew install watchman
in windows npm install watchman
I tried the following:
Restarting my system
Deleting npm/yarn cache.
Most of the times the above methods worked but not always. So, here's one-time permanent solution (for Windows)
Download the Watchman v2021.01.11
Unzip, Rename the folder "Watchman" and paste the C:/Program Files.
Open the folder and copy the location of bin folder (would be C:/Program Files/Watchman/bin)
Go to Environment variables, search of PATH variable and append the copied location of bin
same issue I got on metro Android
I tried the following Steps:-
1.npx react-native start --reset-cache
2.cd android && ./gradlew clean && cd..
3.npx react-native run-android
In mac, I used
watchman watch-del-all
on Terminal
then I re-run the XCode. It's working
Failed to start Watchman watch mode (Windows)
I tried a lot to fixed the issue and at last, I restart my windows now it's working.
I am just trying to spin up a new react-native app but no luck.
react-native init NewApp
cd NewApp
npm install
react-native run-ios
Then see the below error:
** BUILD FAILED **
The following build commands failed:
CompileC /Users/arc/Desktop/websites-dev/react-native/testing_rn/ios/build/Build/Intermediates/React.build/Debug-iphonesimulator/React.build/Objects-normal/x86_64/RCTProfile.o Profiler/RCTProfile.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/testing_rn.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/testing_rn.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Using:
npm 4.1.2
node v7.5.0
El Capitan 10.11.6
Xcode 8.2
package.json:
{
"name": "testing_rn",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "15.4.2",
"react-native": "0.42.3"
},
"devDependencies": {
"babel-jest": "19.0.0",
"babel-preset-react-native": "1.9.1",
"jest": "19.0.2",
"react-test-renderer": "15.4.2"
},
"jest": {
"preset": "react-native"
}
}
It seems like this may be related to the build via terminal but app may still work in xcode?
Print: Entry, ":CFBundleIdentifier", Does Not Exist have tried most solutions
github issue from 25 days ago:
https://github.com/facebook/react-native/issues/12737
Some related questions:
https://github.com/facebook/react-native/issues/7308
React-native run-ios commands fails
=========================================================
UPDATE:
For me, this seemed to have something to do with 0.42.0 and above. I can run a 0.41.2 project that I install with
react-native init --version 0.41.2 example412
cd example412
npm install
react-native run-ios
And boom. It works. But this gets errors:
react-native init example_latest
cd example_latest
npm install
react-native run-ios
then above errors are back. Same errors with init version at 0.42.0:
react-native init --version 0.42.0 example420
cd example420
npm install
react-native run-ios
For me, I guess I needed to update xcode. I thought I was on 8.3 but apparently not. I also needed to update osx to 10.12.4 prior to updating my xcode. Now I'm all good and running a react-native init app at 0.42.3
My remote debugging (Via Chrome with React-native dev tools 0.14.8) used to work fine.
I am not sure what exactly happened in between (I upgraded to react-native 0.21, did an update to android studio, updated Linux Mint 17.3 with apt-get update/ upgrade).
But now all I see is
"Please Wait
Connecting to Remote debugger" for about 5-8 seconds on my emulator, and then I get the error (see attached image):
"Unable to connect with remote debugger"
I have tried re-installing Chrome React-native extensions. Tried rebuilding my app. Did not help.
I am not exactly sure where the problem is. May be I just need to increase a value for connection timeout.. but there does not seem to be an option like that.
Below is also my package.json (it took a couple of days to go through the 0.20 to 0.21 upgrade, due to various dependency problems).
May be there is a new settings there that I am missing, that somebody could point out.
{
"name": "ftesting",
"version": "1.0.0",
"description": "ftesting desc",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node_modules/react-native/packager/packager.sh",
"android-setup-port": "adb reverse tcp:8081 tcp:8080",
"test": "eslint ./src/js.app/my.forms",
"start": "rnws start",
"clean:babelrc": "find ./node_modules -name react-packager -prune -o -name '.babelrc' -print | xargs rm -f",
"postinstall": "npm run clean:babelrc"
},
"repository": {
"type": "git",
"url": "xyz" },
"keywords": [
"ftesting"
],
"author": "ls",
"license": "MIT",
"engines": {
"node": ">=4",
"npm": ">=2 <4"
},
"devDependencies": {
"babel-eslint": "^6.0.0-beta.1",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-1": "^6.5.0",
"eslint": "~2.2.0",
"eslint-loader": "^1.1.1",
"eslint-plugin-react": "^4.2.0"
},
"dependencies": {
"react-native": "^0.21.0",
"#remobile/react-native-splashscreen": "^1.0.3",
"react-native-blur": "^0.7.10",
"react-native-htmlview": "^0.2.0",
"react-native-material-kit": "^0.3.0",
"react-native-material-design": "^0.3.3"
}
}
There's a github issue posted with this problem. You can follow there:
https://github.com/facebook/react-native/issues/6390
Maybe it's silly problem for someone else, if it helps, for me the problem solved when I connected the wifi (I had disconnected it :)
I realized it was a connectivity problem, when I've requested from the browser the url which react native is getting the index.bundle from (the one in config settings in device app) and found that it was reachable...
I'm using 0.25.0-rc
It is definitely working now.
Tested with 0.25.1
Look at the replies in the linked github issue.
Overall, I think the big problem was that once react-native team addressed the orginal issue that was introduced in 0.21, they changed the way you are supposed to build the application.
And if you did not change, the error was salient. So it was impossible to catch it during debug/build process.
Basically since Feb 2016, you are no longer supposed to pull react-native jar from maven repository. Instead, you need to point your gradle.build to the react-native jar from the npm-modules location
allprojects {
repositories {
mavenLocal()
jcenter()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$projectDir/../../node_modules/react-native/android"
}
}
}
and then
compile "com.facebook.react:react-native:+"
this combination of changes above, allowed me to link to the latest copy of the react-native jar, rather than pulling 0.20.1 from maven (and notice that 0.20.1 from maven had not been modified since feb 2016).
This is for apps created with react-native init or ejected from expo.
Start de app with:
react-native run-android
The emulator will show the red screen debugger connection error (that is why we are here in the first place).
With the emulator in focus press:
Ctrl+M
or from the shell issue:
adb shell input keyevent KEYCODE_MENU
The in app Developer Menu will appear:
Click in
Dev settings
Select the option:
Debug server host & port for device
And enter:
localhost:8081
Now we’ll make calls in port 8081 in the emulator go to the same port on the host machine.
From the shell do:
adb reverse tcp:8081 tcp:8081
Ready, just restart the app
react-native run-android
I guess I upgraded node at some point and now when I try to run the packager with npm start it's complaining with:
$ npm start
react-native start
Looks like you installed react-native globally, maybe you meant react-native-cli?
To fix the issue, run:
npm uninstall -g react-native
npm install -g react-native-cli
Node 5.1.0, npm 3.3.12 and react-native 0.15.0
It looks like the preferred way to start the packager now for an IOS app is by hitting the run button in xcode itself or using the following command:
react-native start
I'm using:
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start"
}
I got the same error.
It turns out it's because npm finds another react-native inside node_modules due to being started with a vastly different environment.
So I changed my package.json to look like this:
"scripts": {
"start": "$NVM_BIN/react-native start"
}
Did you follow the instructions and do?
npm uninstall -g react-native
npm install -g react-native-cli
I say this, because I kept making the error of installing react-native instead of react-native-cli.
export PATH="/Users/my-mac/Library/Android/sdk/platform-tools":$PATH
./adb reverse tcp:8081
./adb start-server
./adb devices
I've been in this situation or days, no solution yet, so I had to downgrade to Expo#19.0.0, and it worked
if you like to follow my steps:
in package.json update devDependencies:
"jest-expo": "19.0.0"
"react-native-scripts": "1.0.0"
in package.json update dependencies:
"expo": "19.0.0"
in app.json update the sdkVersion to 19.0.0
In my case, I would use npm start or react-native start and it would install the debug version of my app just fine, but the packager wouldn't start.
I found out it was because another process was using my 8081 port.
Check what processes are using that port if you're not specifying another port with lsof -i tcp:8081 in terminal, or any other tool to find out what processes are using what port.