I am trying to create a react app on windows 32 bit PC using command create-react-app my-app through the yarn which it creates successfully but not proceeding to display success message due to that yarn start is not working.
Why is this happening?
Related
I've been looking for a solution to this issue for a day now but couldn't fix it.
I have not used react native for a month when everything was working fine.
Now, if I try to run an existing project that used to work (react native 0.59.5) or a brand new project (react native 0.59.9) with the iOS simulator on my mac, I get the error:
Failed to load bundle - Could not connect to development server
Any idea how I can fix this?
Ok found the issue. Was thinking it might be watchman related issue and wanted to use the command brew reinstall watchmanto reinstall it. By running this command, I found an error
Error: Xcode alone is not sufficient on Mojave. Install the Command Line Tools: xcode-select --install
Looks like the command line tools for xCode was not available anymore.
I launched the command xcode-select --install and then reinstalled watchman just in case. It is now working!
Couldn't connect to development server error
This error is received when the metro bundler isn't running in port 8081. To start the bundler, from project folder run:
npm start
Now, try reloading your app (ctrl + R for iOS / r+r for Android).
Also, check your terminal in case the project failed initial build due to some error.
I'm new to reactnative. I have followed steps to install reactnative properly but, while creating a new project, I'm getting an error. I'm using Windows 7 64 bit with i3 processor.
c:\ReactNativeProjects>react-native init AwesomeProject
Command npm install --save --save-exact react-native failed.
My Folder contains only one file
Since you are starting to use React Native, consider using Expo, I've used it and it makes developing, debugging, testing and deploying to the apple store and google play easier.
According to the official docs:
Expo is the easiest way to start building a new React Native
application. It allows you to start a project without installing or
configuring any tools to build native code - no Xcode or Android
Studio installation required (see Caveats).
Assuming that you have Node installed, you can use npm to install the
Expo CLI command line utility:
npm install -g expo-cli
Then run the following commands to create a
new React Native project called "AwesomeProject":
expo init AwesomeProject
cd AwesomeProject
npm start
This will start a development server for
you.
I've answered a question in SO for the steps and what happens when you build your .apk and .ipa files using Expo, have a look at that as well.
These are my steps to get rid of this error:
Please upgrade your npm
npm install -g npm#latest
Run npm cache clean command in Command prompt ( With some element of doubt for cache presence)
3.Ran react-native init in command prompt as Administrator (on Windows OS), hoping works well with sudo react-native init on Mac OS
If still problem persist make sure that you have followed each and every step mentioned in Documentation i.e. installed JDK, PYTHON, NODE.
Refer to this link For windows
I have used create-react-native-app and expo to build an application on a vagrant ubuntu and run it using yarn start.
When i make changes to my file on my host machine, the changes are not
reflected.
With create-react-app, CHOKIDAR_USEPOLLING=true worked and all my
changes were reflected instantly but this is not the case for native.
Does anyone know how to get this to work?
Please try using yarn start instead of npm start since your current of npm (5) has issues with create-react-native-app as of today.
I am getting this error when I try to run react-native application on my device.
Steps I did:
react-native init SampleApp
cd SampleApp
react-native run-android
react-native start
PS: On first attempt I did successfully run react-native app. Now I am getting this error. I searched a lot but couldn't find solution yet.
Normally, running react-native run-android will open up another command prompt to start the React Packager.
If the packager is somehow not started properly, you can try the following steps:
Run react-native start first to start the packager server manually.
Run react-native run-android which it will detect the packager is running and proceed with deploying the application into the device/emulator.
First, you mus open the react-native local packet server:
react-native start or npm start.
If there is still a problem, may be:
The IP address might be wrong.
Phone cannot access the IP address
Shake your devices show Menu(or click your devices Menu), click the last item dev config setup your computer ip, like 192.168.*.*:8081
The reason is that another application takes port 8081, which is needed for running Metro Bundler. After doing some research, I found out someone does "react-native start" to start the bundler before running "react-native run-ios/android". Running "react-native run-ios" is successful when I previously started the Bundler. After running "react-native run-android", the app can be viewed. However, after could click R to reload the app, it shows 404.
Make sure your port 8081 is not taken by another app. If so, every time when we type "react-native run-ios/android", the Bundler can be automatically started.
When the app is loaded, the window of Bundler should have a progress bar showing the detail of loading the bundle file under ios/android.
BUNDLE [android, dev] ./index.js ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.0% (481/481), done.
I just started on a fresh dev environment with Xcode 7.2.1, and installed react-native (0.20.0). I initialized a test project to see if it would run, and I got the following error:
~/dev/TestProj/node_modules/react-native/packager ~
packager.sh: line 11: node: command not found
The iOS Simulator screen says:
Could not connect to development server.
Ensure the following:
- Node server is running and available on the same network - run 'npm start' from react-native root
- Node server URL is correctly set in AppDelegate
URL: http://localhost:8081/index.ios.bundle?platform=ios&dev=true
Sure enough, if I go into the project folder in a terminal window and run 'npm start' from there, the packager starts and everything works. In my experience the packager should run by itself though when you run a project with React Native. Am I doing something wrong here or is there an issue? Never had this happen with previous versions of RN.
I moved on to trying to get my old project working, and while trying to use npm to add new packages, I added the following to my ~/.profile. I'm guessing this fixed it:
export NPM_DIR="$HOME/.npm" [ -s "$NPM_DIR/npm.sh" ] && . "$NPM_DIR/npm.sh"