You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
"Could not connect to developmenet server" for newly created projects since yesterday. #8358
Since yesterday, i am trying to create new project and build debug apk but getting error "could not connect to development server" where my old projects are working fine.
I am using updated versions for react native, npm and nodejs.
I think he's on a real device with the packager running on his computer. RN no longer binds the packager to 0.0.0.0 - instead it's only bound on localhost? Correct me if I'm wrong. I'm also experiencing this issue.
Not sure if it's the same issue but a newly created project of mine fails to start the development server with an error concerning ES6 Arrow functions
Could be a missing babel compiling step for the development server or an error in the babel configuration.
/node_modules/react-native/local-cli/server/formatBanner.js:48
chalkFunction: (fn) => fn,
^
SyntaxError: Unexpected token >
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/node_modules/react-native/local-cli/server/checkNodeVersion.js:12:20)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
Using:
Node 6.2.2
react-native 0.28.0
Edit: slamming face on keyboard
Found the problem in my case.
Using NVM, I have installed legacy node version for old project. NVM decided to use this node version as default for new terminal sessions. As the packager started in a new terminal window it was using the old node version... So i told nvm to use the 6.2.2 as default and now I can connect.
I've just upgraded to 0.28.0 and I'm getting Could not connect to development server red box error message when I try to view my app in the iOS simulator. There are no errors in npm, no output at al lin fact - its as if the request isn't even being made.
The same goes for a physical iOS device, however I've also tried a physical android device and it works fine on there.
I then tried a fresh AwesomeProject and that works fine on the iOS simulator.
So I'm wondering if the react-native upgrade process has some how broken the Xcode project files.
@charlie-rc
"So i told nvm to use the 6.2.2 as default "....please can you explain how can i try this using terminal?
Sorry for the delay. You can use the command: nvm alias default 6.2.2 to tell nvm to load this one as default
Ok did the upgrade, just spent the past 4 hours trying to get the emulator working. Now the emulator works, but when I try to build the native app for my phone I get the same (fn) => fn error that jbultmann got above. Using node 6.2.2. Only happens when attempting to build for the device. Anyone?
Update
Modified the output from xcode to make sure the correct node version was running. It is reporting 6.2.2. If I copy the final line in the execution sequence and paste it in the console, it bundles correctly. GRRR.
Bundle React Native code and images shell:
node -v
which node
export NODE_BINARY=node
../node_modules/react-native/packager/react-native-xcode.sh
@npomfret's solution worked for me - adding this to my Info.plist solved it: <key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> ...
That only solves the issue with the emulator (because the connection to
localhost isn't ssl). I have this in the plist. Its compiling for a real
device that is failing
Be warned that this is now considered a security risk (read this). You can specify a particular domain (but not an ipaddress i believe). You don't need to do this in order to deploy to the simulator because the default settings in Info.plist allow http access to localhost. And you don't need it when you push you app to production.
And your AppDelegate.m file will also need something like:
Activity
faisalil commentedon Jun 23, 2016
Are you debugging in an emulator? or real device?
mitchellhuang commentedon Jun 23, 2016
I think he's on a real device with the packager running on his computer. RN no longer binds the packager to 0.0.0.0 - instead it's only bound on localhost? Correct me if I'm wrong. I'm also experiencing this issue.
edit: i'm wrong @npomfret's solution fixed mine
charlie-rc commentedon Jun 24, 2016
Actually i am facing the problem, both when running on emulator (android studio) and on actual device both.
IlyasM commentedon Jun 24, 2016
I am also experiencing this issue on real device on 0.29.0-rc
jbultmann commentedon Jun 24, 2016
Not sure if it's the same issue but a newly created project of mine fails to start the development server with an error concerning ES6 Arrow functions
Could be a missing babel compiling step for the development server or an error in the babel configuration.
/node_modules/react-native/local-cli/server/formatBanner.js:48
chalkFunction: (fn) => fn,
^
SyntaxError: Unexpected token >
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/node_modules/react-native/local-cli/server/checkNodeVersion.js:12:20)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
Using:
Edit:
slamming face on keyboard
Found the problem in my case.
Using NVM, I have installed legacy node version for old project. NVM decided to use this node version as default for new terminal sessions. As the packager started in a new terminal window it was using the old node version... So i told nvm to use the 6.2.2 as default and now I can connect.
charlie-rc commentedon Jun 24, 2016
"So i told nvm to use the 6.2.2 as default "....please can you explain how can i try this using terminal?
npomfret commentedon Jun 24, 2016
I've just upgraded to 0.28.0 and I'm getting
Could not connect to development serverred box error message when I try to view my app in the iOS simulator. There are no errors in npm, no output at al lin fact - its as if the request isn't even being made.The same goes for a physical iOS device, however I've also tried a physical android device and it works fine on there.
I then tried a fresh AwesomeProject and that works fine on the iOS simulator.
So I'm wondering if the
react-native upgradeprocess has some how broken the Xcode project files.npomfret commentedon Jun 24, 2016
Solved it - i made a mistake merging
Info.plistand lost this:terrysahaidak commentedon Jun 24, 2016
Any fix?
@huangbong i'm running on my device. so now what should i do?
christopherdro commentedon Jun 26, 2016
/cc @jsierles Is this related to the recent addition of auto ip?
xiangfengsu commentedon Jun 27, 2016
me too !!!
Could not connect to development server.
Ensure the following:
URL: http://192.168.1.245:8081/index.ios.bundle?platform=ios&dev=true
jbultmann commentedon Jun 27, 2016
@charlie-rc
"So i told nvm to use the 6.2.2 as default "....please can you explain how can i try this using terminal?
Sorry for the delay. You can use the command:
nvm alias default 6.2.2to tell nvm to load this one as defaultkaelhem commentedon Jul 4, 2016
@jbultmann
Thx! I had the same issue, and this fix it for me too.
deavial commentedon Jul 8, 2016
Ok did the upgrade, just spent the past 4 hours trying to get the emulator working. Now the emulator works, but when I try to build the native app for my phone I get the same (fn) => fn error that jbultmann got above. Using node 6.2.2. Only happens when attempting to build for the device. Anyone?
Update
Modified the output from xcode to make sure the correct node version was running. It is reporting 6.2.2. If I copy the final line in the execution sequence and paste it in the console, it bundles correctly. GRRR.
Bundle React Native code and images shell:
Output:
deavial commentedon Jul 9, 2016
moving my issue to a new bug as it is bigger than this and not related to NSAllowArbitraryLoads
ajaxmac commentedon Jul 11, 2016
@npomfret's solution worked for me - adding this to my Info.plist solved it:
<key>NSAppTransportSecurity</key> <dict> <key>NSAllowsArbitraryLoads</key> <true/> ...deavial commentedon Jul 11, 2016
That only solves the issue with the emulator (because the connection to
localhost isn't ssl). I have this in the plist. Its compiling for a real
device that is failing
On Monday, July 11, 2016, Ajax McKerral notifications@github.com wrote:
Amerr commentedon Jul 16, 2016
@npomfret please elaborate solution on how to fix this issue. Is just confusing
npomfret commentedon Jul 17, 2016
As of RN 0.29, if you want to deploy to a physical iOS device, you need to ensure that your apps
Info.plistfile contains the following:Be warned that this is now considered a security risk (read this). You can specify a particular domain (but not an ipaddress i believe). You don't need to do this in order to deploy to the simulator because the default settings in
Info.plistallow http access to localhost. And you don't need it when you push you app to production.And your
AppDelegate.mfile will also need something like:JosephDev commentedon Jul 20, 2016
@npomfret your solution is work. For other people, I attached my Info.plist
RN 0.29.x Info.plist should like this
To connect local server with ip address, we need not only
NSExceptionDomains, but alsoNSAllowsArbitraryLoadsThanks @npomfret
mkonicek commentedon Oct 27, 2016
Hi there! This issue is being closed because it has been inactive for a while.
But don't worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/could-not-connect-to-developmenet-server-for-newly-created-projects-since-yesterday
Product Pains has been very useful in highlighting the top bugs and feature requests:
https://productpains.com/product/react-native?tab=top
Also, if this issue is a bug, please consider sending a pull request with a fix.
ajiprasetyo commentedon Jan 6, 2017
i had same problem like you and i resolved it,
my mobile device android version 5.0.2
steps:
maybe can help you
JosephDev commentedon Jan 11, 2017
@ajiprasetyo on your physical device, you can set the url on developer setting.
Here is some steps from official site
ajiprasetyo commentedon Jan 13, 2017
@JosephDev thanks its work too, if u want run project via wi-fi :)
rajathithan commentedon Jun 18, 2017
This can be resolved by the dev settings inside the emulator , please visit my site for more information,
http://gadoth.com/react-native-series-post-1-installation-setup/